Module: Lab42::Function::Constructors

Included in:
Lab42::Function
Defined in:
lib/lab42/function/constructors.rb

Constant Summary collapse

R =
Lab42::Function::ParamsReorderer

Instance Method Summary collapse

Instance Method Details

#a1Object



47
# File 'lib/lab42/function/constructors.rb', line 47

def a1; placeholder 1 end

#a2Object



48
# File 'lib/lab42/function/constructors.rb', line 48

def a2; placeholder 2 end

#a3Object



49
# File 'lib/lab42/function/constructors.rb', line 49

def a3; placeholder 3 end

#constant(const_val) ⇒ Object Also known as: c



8
9
10
# File 'lib/lab42/function/constructors.rb', line 8

def constant const_val
  new ->{ const_val }, 0
end

#force_pipeObject Also known as: f



26
27
28
# File 'lib/lab42/function/constructors.rb', line 26

def force_pipe
  @__force_pipe__ ||= BasicObject.new
end

#free_receiver(msg, *first_stage_params, &blk) ⇒ Object Also known as: s



13
14
15
16
17
18
19
20
21
22
# File 'lib/lab42/function/constructors.rb', line 13

def free_receiver msg, *first_stage_params, &blk
  unless blk
    return new ->(rcv, *second_stage_params){
      mthd = rcv.method(msg)
      mthd.(*R.combine_and_reorder(first_stage_params, second_stage_params))
    }
  end

  chained_free_receiver msg, first_stage_params, blk
end

#partial(rcv, msg, *first_stage_params, &blk) ⇒ Object Also known as: p



31
32
33
34
35
36
37
38
39
40
# File 'lib/lab42/function/constructors.rb', line 31

def partial rcv, msg, *first_stage_params, &blk
  mthd = rcv.method msg
  unless blk
    return new ->(*second_stage_params){
      mthd.(*R.combine_and_reorder(first_stage_params, second_stage_params))
    }
  end

  chained_partial mthd, first_stage_params, blk
end

#placeholder(n) ⇒ Object Also known as: a



43
44
45
# File 'lib/lab42/function/constructors.rb', line 43

def placeholder n
  Function::Placeholder.make(n)
end