Hi,
In message "[ruby-talk:03541] function objects?"
on 00/06/19, Johann Hibschman <johann / physics.berkeley.edu> writes:
|I read in one of the descriptions of the language that Ruby does not
|have first-class functions. Is this true? And, if so, what does Ruby
|have which makes this livable?
Yes, it's true. Instead, Ruby has Procs (aka closure) and
method objects.
|As a concrete example, what would I do if I wanted a numeric
|integration function, like
|
| integrate(f, x_min, x_max) -> the integral of f(x)
Probably:
integrate(lambda{|x| f(x)}, x_min, x_max)
matz.