From: David Alan Black Date: 2000-12-15T05:32:41+09:00 Subject: [ruby-talk:7251] Re: Why isn't Perl highly orthogonal? Hello -- On Fri, 15 Dec 2000, Ben Tilly wrote: (map & grep) > In Ruby the two concepts are orthogonal. I don't yet know > if you can have a function that returns different numbers > of elements different times. Certainly the first thing I > tried to do with map was return 2 elements for 1. (Looking > at a case where I know current production versions of Perl > doesn't scale.) I couldn't see how to do it. And grep > itself cannot be used with arbitrary blocks. (Therefore > it is truer to the actual name of the function!) (I remember being relieved when I discovered find_all, after trying to get grep to act like Perl's grep.) As for map mapping two(or more)-for-one, I've done it, when needed, along these lines: [1,2,3,4,5].map do |e| [e,-e] end .flatten => [1, -1, 2, -2, 3, -3, 4, -4, 5, -5] David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav