From: Jeffrey Dik Date: 2005-10-20T23:38:59+09:00 Subject: Re: Functional with Ruby On Thu, Oct 20, 2005 at 04:51:19AM +0900, Edward Faulkner wrote: > On Thu, Oct 20, 2005 at 04:34:49AM +0900, Ara.T.Howard wrote: > > i don't think it is functional because the name of the function > > cannot be used as a first class object. > > Well, that's true of Ruby in general. If you want to turn a method > name into a first class object, you can do this: > > x = myarray.instance_method(:inject) I believe you mean... x = myarray.method(:inject) > x.call {|a,b| a+b} > > Or this: > > x = Array.instance_method(:inject) > x.bind(myarray).call {|a,b| a+b} > > regards, > Ed Jeff