No, sorry for the confusion, the higher order function transformation was this:
results = []
Dir['**/*'].each do |p|
next unless (... ...)
results << p if (... ...)
end
results
Into this:
Dir['**/*'].select {|x| (... ...) }
Other good examples are Array#map, Array#reduce and Array#grep.
PS I apologize for the indentation, my mail client is acting up.
On Thursday, 12 May 2011 at 10:20 pm, 7stud -- wrote:
Is it a higher order function because it calls a global method?
>
> --
> Posted via http://www.ruby-forum.com/.
>