Comma quibbling: Difference between revisions
Content deleted Content added
→Counted replacement: Possible trans of Tcl. I know I skimmed the entry and new Tcl was now a one-liner. |
Mathematica |
||
Line 155: | Line 155: | ||
quibble ["ABC"; "DEF"; "G"] |
quibble ["ABC"; "DEF"; "G"] |
||
quibble ["ABC"; "DEF"; "G"; "H"]</lang> |
quibble ["ABC"; "DEF"; "G"; "H"]</lang> |
||
=={{header|Mathematica}}== |
|||
<lang Mathematica>quibble[words___]:= |
|||
ToString@{StringJoin@@ |
|||
Replace[Riffle[{words}, ", "], {prefix___, x1_, ", ", x2_}->{prefix, x1, " and ", x2}]}</lang> |
|||
{{out}} |
|||
<pre> |
|||
In[2]:= quibble[] |
|||
Out[2]= {} |
|||
In[3]:= quibble["ABC"] |
|||
Out[3]= {ABC} |
|||
In[4]:= quibble["ABC","DEF"] |
|||
Out[4]= {ABC and DEF} |
|||
In[5]:= quibble["ABC","DEF","G","H"] |
|||
Out[5]= {ABC, DEF, G and H} |
|||
</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |