Jump to content

Comma quibbling: Difference between revisions

Add Miranda
(Add lang example)
(Add Miranda)
Line 2,731:
</syntaxhighlight>
 
=={{header|Miranda}}==
<syntaxhighlight lang="miranda">main :: [sys_message]
main = [Stdout (show test ++ ": {" ++ quibble test ++ "}\n") | test <- tests]
 
tests :: [[[char]]]
tests = [ [],
["ABC"],
["ABC","DEF"],
["ABC","DEF","G","H"] ]
 
quibble :: [[char]]->[char]
quibble [] = []
quibble [word] = word
quibble [word1,word2] = word1 ++ " and " ++ word2
quibble (word:words) = word ++ ", " ++ quibble words</syntaxhighlight>
{{out}}
<pre>[]: {}
["ABC"]: {ABC}
["ABC","DEF"]: {ABC and DEF}
["ABC","DEF","G","H"]: {ABC, DEF, G and H}</pre>
=={{header|NetRexx}}==
<syntaxhighlight lang="netrexx">/* NetRexx */
2,124

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.