RosettaCodeData/Task/Comma-quibbling/Mathematica/comma-quibbling.math

5 lines
148 B
Text
Raw Permalink Normal View History

2015-02-20 09:02:09 -05:00
quibble[words___] :=
ToString@{StringJoin@@
Replace[Riffle[{words}, ", "],
{most__, ", ", last_} -> {most, " and ", last}]}