From: Mike Stok Date: 2006-04-02T07:36:49+09:00 Subject: Re: %w{tomato cheese ham pineapple}.join(', ', ' and ') On 1-Apr-06, at 3:32 PM, Cameron McBride wrote: > On 4/1/06, Benjohn Barnes wrote: >> => 'tomato, cheese, ham and pineapple' >> >> Is something I'd like to be able to do, and I almost thought it's be >> part of the standard. Is there already a standard way of getting that >> (facets, perhaps?)? Any chance it'll make it in to the standard >> Enumerable? > > another alternative: > > %w{tomato cheese ham pineapple}.join(', ').sub(/, (\S+)$/,' and \1') > > (I'm not Mr. Grammar, but I usually remove the last comma before > the "and") The Oxford comma is useful and acceptable. If there is any ambiguity in the list then the comma can be most useful. To lift from http:// www.worldwidewords.org/qa/qa-oxf1.htm: > The argument for using it is that it reduces the risk of ambiguity. > For example, if you were to write �He studied Roman history, > international politics and economics� it is not obvious whether > international refers only to politics or also to economics. Putting > the serial comma in removes that doubt. In practice, an alert > writer will spot the potential problem and can often write around it. > > Perhaps the best argument for the serial comma is that apocryphal > book dedication: �To my parents, Ayn Rand and God�. Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.