From: Brian Candler Date: 2009-01-14T19:17:45+09:00 Subject: Re: Point free (pointless) programming in ruby? > 1) Is there a neater way of expressing a sequence of function > compositions in Ruby? Maybe you could define an Array#to_proc. e.g. class Array def to_proc lambda { |src| inject(src) { |memo,proc| proc[memo] } } end end a1 = lambda { |x| x+"a1" } b1 = lambda { |x| x+"b1" } c1 = lambda { |x| x+"c1" } p lambda(&[a1,b1,c1])["test"] src = ["foo","bar","baz"] p src.map(&[a1, b1, c1]) def a(x); x+[1]; end def b(x); x+[2]; end src = [[], [0], [0,0]] p src.map(&[method(:a), method(:b)]) -- Posted via http://www.ruby-forum.com/.