Comma quibbling: Difference between revisions

updated solution for Arturo
(Add Miranda)
(updated solution for Arturo)
Line 735:
 
=={{header|Arturo}}==
<syntaxhighlight lang="rebol">quibble: function $[seqsequence :block][
if? 0 =size seq ->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 ⟶ 761:
<pre>{}
{ABC}
{ABC, DEF and DEF}
{ABC, DEF, G, H and H}</pre>
 
=={{header|Astro}}==
1,532

edits