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 or pull requests.
Find a file
2010-05-20 21:28:39 +02:00
lib MapReduce: first code - needs tokyocabinet 2010-05-20 21:28:39 +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
Rakefile 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
VERSION Version 0.1.0: Vollstaendig neugeschrieben. Klassen statt Lambdas. Erweiterbar 2010-05-20 17:07:23 +02:00

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.