module Necromancy::Control::Category
Public Instance Methods
<(callable)
click to toggle source
Right-to-left composition
- @note self
-
b -> c
@param [Object] callable a -> b @return [Necromancy] a -> c @example
require 'necromancy' N = Necromancy.Category.new f = lambda(&N.to_i < N * 2) # == ->(o) { (o * 2).to_i } f.('42') # => 4242
# File lib/necromancy/control/category.rb, line 32 def <(callable) str = make_evaluable_string(callable) necromancy = "args = (#{str}); #{@necromancy}" self.class.new(necromancy, @references.dup) end
>(callable)
click to toggle source
Left-to-right composition.
- @note self
-
a -> b
@param [Object] callable b -> c @return [Necromancy] a -> c @example
require 'necromancy' N = Necromancy.Category.new f = lambda(&N.to_i > N * 2) # == ->(o) { o.to_i * 2 } f.('42') # => 84
# File lib/necromancy/control/category.rb, line 17 def >(callable) str = make_evaluable_string(callable) necromancy = "args = (#{@necromancy}); #{str}" self.class.new(necromancy, @references.dup) end