[Vit-discuss] Top Ruby Projects algorithm?

Martin DeMello martindemello at gmail.com
Fri Aug 25 16:35:19 EDT 2006


On 8/26/06, Gavin Kistner <gavin.kistner at anark.com> wrote:
> > Array difference might be another good candidate:
> >
> > cities = %w(London Oslo Paris Amsterdam Berlin)
> > visited = %w(Berlin Oslo)
> > puts "I still need to visit the following cities: " + (cities -
> > visited).join(",")
>
> I like that, but (for brevity) I might change it to:
> cities = %w(London Oslo Paris Amsterdam Berlin)
> visited = %w(Berlin Oslo)
> puts "I still need to visit the following cities:", (cities - visited)

Good point! The join is just clutter there.

martin


More information about the vit-discuss mailing list