Comma quibbling: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) |
(Add Quackery) |
||
Line 3,243: | Line 3,243: | ||
Input: ['ABC', 'DEF', 'G', 'H'] -> Output: '{ABC, DEF, G and H}' |
Input: ['ABC', 'DEF', 'G', 'H'] -> Output: '{ABC, DEF, G and H}' |
||
>>> </lang> |
>>> </lang> |
||
=={{header|Quackery}}== |
|||
<lang quackery>[ swap join join ] is glue ( [ [ [ --> [ ) |
|||
[ [ dup size |
|||
dup 0 = iff |
|||
[ 2drop [] ] done |
|||
dup 1 = iff |
|||
[ drop unpack ] done |
|||
2 = iff |
|||
[ unpack $ ' and ' glue ] done |
|||
behead swap recurse $ ', ' glue ] |
|||
$ '{' swap join $ '}' join ] is quibble ( [ --> $ ) |
|||
[] quibble echo$ cr |
|||
$ 'ABC' nest$ quibble echo$ cr |
|||
$ 'ABC DEF' nest$ quibble echo$ cr |
|||
$ 'ABC DEF G H' nest$ quibble echo$</lang> |
|||
{{out}} |
|||
<pre> |
|||
{} |
|||
{ABC} |
|||
{ABC and DEF} |
|||
{ABC, DEF, G and H} |
|||
</pre> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |