From: Tobias Nurmiranta Date: 2004-02-25T07:37:34+09:00 Subject: Re: Need examples comparing Ruby to Python Hi, On Wed, 25 Feb 2004, Hal Fulton wrote: > If I do: > > def func(word) > consonants = word.gsub(/[aeiou]/,"") > puts consonants > end > > words.each {|word| func(word) } > > then I have still used a block, one that happens to call a function > (with a name) that will only be used once. A difference between ruby and python is that functions can easily be passed as arguments in python. For example a function that returns the composition of two functions applied to a value. (An artificial example :) def compose(f, g, x): return f(g(x)) But then this is even more nicer i scheme. (defun (compose f g) (lambda (x) (f (g x))) ;; returns a function, that can be applied later. ((compose 1+ 1+) 1) => 3 In ruby you have to create a Method instance first, and then pass it as an argument. (newbie warning. :) , Tobias