Method: MicroKanren::Core#bind

Defined in:
lib/micro_kanren/core.rb

#bind(d, g) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/micro_kanren/core.rb', line 87

def bind(d, g)
  if d.nil?
    mzero
  elsif procedure?(d)
    -> { bind(d.call, g) }
  else
    mplus(g.call(car(d)), bind(cdr(d), g))
  end
end