Comma quibbling: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Miranda) |
Drkameleon (talk | contribs) (updated solution for Arturo) |
||
Line 735: | Line 735: | ||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
<syntaxhighlight lang="rebol">quibble: |
<syntaxhighlight lang="rebol">quibble: $[sequence :block][ |
||
if? 0 = size sequence |
|||
-> return "{}" |
|||
else [ |
|||
if? 1=size seq -> "{" ++ seq\0 ++ "}" |
|||
if? 1 = size sequence |
|||
else -> "{" ++ (join.with:", " slice seq 0 (size seq)-1) ++ " and " ++ (last seq) ++ "}" |
|||
-> return ~"{|sequence\0|}" |
|||
] |
|||
last: pop 'sequence |
|||
return ~« {|join.with: ", " sequence| and |last|} |
|||
] |
] |
||
Line 758: | Line 761: | ||
<pre>{} |
<pre>{} |
||
{ABC} |
{ABC} |
||
{ABC |
{ABC and DEF} |
||
{ABC, DEF, G |
{ABC, DEF, G and H}</pre> |
||
=={{header|Astro}}== |
=={{header|Astro}}== |