>class Array > def each2(&p) > collect {|a| > a.length > }.min.times {|i| > yield collect {|a|a[i]} > } > end >end Indeed. Very nice. >note that turning the above into Common Lisp's "map" function should >be fairly easy. (about 8 more chars.) Sure, def collect2(&p) x=[] collect {|a| a.length }.min.times {|i| x << yield(collect {|a| a[i]}) } x end Raja p.s. The code between each2 and collect2 being so similar, out of curiosity, i tried toying around to see if it could be generalized in Ruby. Something like: [a1,a2,a3, ...].loop_n (:collect} {...} [a1,a2,a3, ...].loop_n (:each} {...} [a1,a2,a3, ...].loop_n (:min} {...} etc would like to do it concisely as: f( yield(collect {|a| a[i]}) ) where the accumulation method 'f' would naturally vary in each situation. Something to play with ... p.p.s Not to start a language war ... but i'm continuously amazed at the genius of McCarthy in the design of the Cambridge prefix notation for Lisp. Granted, its an acquired taste and with experience the parens fade into the background, but one gains enormous uniformity: e.g 1 (map f l1) ; f is of arity 1 (map f l1 l2 l3) ; f is of arity 3 single iteration as well as parallel iteration is done the same way; no need for different constructs. e.g 2 rather than having x + y f(x) x.f builtin operators / functions / CLOS methods are all expressed uniformly as (f x y z) (being "fully" OO Ruby is certainly much more uniform than C++/Java) As someone in their .sig once said: All operating systems want to be Unix, All programming languages want to be Lisp. ;-)