Comma quibbling: Difference between revisions
Content added Content deleted
(Add lang example) |
Not a robot (talk | contribs) (Add Miranda) |
||
Line 2,731: | Line 2,731: | ||
</syntaxhighlight> |
</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}}== |
=={{header|NetRexx}}== |
||
<syntaxhighlight lang="netrexx">/* NetRexx */ |
<syntaxhighlight lang="netrexx">/* NetRexx */ |