Comma quibbling: Difference between revisions

Add Quackery
(Add Quackery)
Line 3,243:
Input: ['ABC', 'DEF', 'G', 'H'] -> Output: '{ABC, DEF, G and H}'
>>> </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}}==
1,808

edits