G
greg
A look through RAA and rubyforge doesn't show any functional
programming libraries, are there any that I haven't noticed? Any one
interested in starting functional.rb? Here are some functional
helpers I have used.
class Object
def tap
yield self
return self
end
end
require 'enumerator'
module Enumerable
def map_msg(meth, *args)
if block_given?
map{|e| yield( e.send(meth, *args) )}
else
map{|e| e.send(meth, *args)}
end
end
def thread_map
map do |e|
Thread.new(e) {|thr_e| yield thr_e}
end.map_msg
value)
end
def thread_map_msg( meth, *args )
if block_given?
map { |e| Thread.new(e) do |thr_e|
yield thr_e.send(meth, *args)
end }.map_msg
value)
else
map { |e| Thread.new(e) do |thr_e|
thr_e.send( meth, *args )
end }.map_msg
value)
end
end
end
programming libraries, are there any that I haven't noticed? Any one
interested in starting functional.rb? Here are some functional
helpers I have used.
class Object
def tap
yield self
return self
end
end
require 'enumerator'
module Enumerable
def map_msg(meth, *args)
if block_given?
map{|e| yield( e.send(meth, *args) )}
else
map{|e| e.send(meth, *args)}
end
end
def thread_map
map do |e|
Thread.new(e) {|thr_e| yield thr_e}
end.map_msg
end
def thread_map_msg( meth, *args )
if block_given?
map { |e| Thread.new(e) do |thr_e|
yield thr_e.send(meth, *args)
end }.map_msg
else
map { |e| Thread.new(e) do |thr_e|
thr_e.send( meth, *args )
end }.map_msg
end
end
end