select, collect, .... all these methods work like a breadth-first search. With functional, it will work like a depth-first search. It's not faster, but it needs lesser memory.
This repository has been archived on 2021-12-03. You can view files and clone it, but cannot push or open issues/pull-requests.
Go to file
Denis Knauf 162dbb020c eval -> many lambdas. #map added 2010-04-20 16:50:59 +02:00
lib eval -> many lambdas. #map added 2010-04-20 16:50:59 +02:00
AUTHORS ready for gem 2010-04-19 21:08:49 +02:00
LICENSE ready for gem 2010-04-19 21:08:49 +02:00
README.md #map/#reduce will raise an error. Functional can be used like Enumerator. Version 0.0.1 2010-04-19 21:22:30 +02:00
Rakefile ready for gem 2010-04-19 21:08:49 +02:00
VERSION #map/#reduce will raise an error. Functional can be used like Enumerator. Version 0.0.1 2010-04-19 21:22:30 +02:00

README.md

Install

gem install functional

Usage

require 'functional'

obj = 0 .. 10**12
Functional.new( obj).select {|i| i.even? }.collect {|i| i/3 }.select {|i| i.even? }.each &method( :puts)

What's with #map?

Do you know MapReduce? In future #map will be used for MapReduce. Use #collect.