Comma quibbling: Difference between revisions
m
→{{header|Factor}}: give the comma-quibble word fewer responsibilities
m (→{{header|Factor}}: edit whitespace) |
m (→{{header|Factor}}: give the comma-quibble word fewer responsibilities) |
||
Line 1,227:
IN: rosetta-code.comma-quibble
: wrap ( str --
: quibble-pair ( seq -- str ) " and " join wrap ;
Line 1,235:
quibble-pair ;
: comma-quibble ( seq -- str )
dup length {
{ 0 [ drop "{}" ] }
Line 1,241:
{ 2 [ quibble-pair ] }
[ drop quibble-list ]
} case
{ } qw{ ABC } qw{ ABC DEF } qw{ ABC DEF G H }
[ comma-quibble print ] 4 napply</lang>
{{out}}
<pre>
|