Sha256: 51bc5bf62727a9bdab195e8fb2ce3d756fa7058d7feec4a3c9c6f238b893625d

Contents?: true

Size: 233 Bytes

Versions: 15

Compression:

Stored size: 233 Bytes

Contents

class Proc
  # function coposition
  # i.e., f compose g => f of g => f (g args)
  def compose *procs, &block
    procs << block if block
    lambda{ |*args| ([self] + procs).reverse.inject(args){ |val, fun| fun[*val] } }
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
godfat-ludy-0.1.13 lib/ludy/proc/compose.rb
ludy-0.1.15 lib/ludy/proc/compose.rb
ludy-0.1.0 lib/ludy/proc/compose.rb
ludy-0.1.1 lib/ludy/proc/compose.rb
ludy-0.1.10 lib/ludy/proc/compose.rb
ludy-0.1.11 lib/ludy/proc/compose.rb
ludy-0.1.13 lib/ludy/proc/compose.rb
ludy-0.1.2 lib/ludy/proc/compose.rb
ludy-0.1.9 lib/ludy/proc/compose.rb
ludy-0.1.3 lib/ludy/proc/compose.rb
ludy-0.1.4 lib/ludy/proc/compose.rb
ludy-0.1.5 lib/ludy/proc/compose.rb
ludy-0.1.7 lib/ludy/proc/compose.rb
ludy-0.1.8 lib/ludy/proc/compose.rb
ludy-0.1.6 lib/ludy/proc/compose.rb