struct Kanren::State(T)

Defined in:

kanren/state.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def [](var) : T #

Return the value bound to the given Var, or raise KeyError if unbound.


[View source]
def []?(var) : T | Nil #

Return the value bound to the given Var, or nil if unbound.


[View source]
def bindings #

[View source]
def bindings=(bindings : Immutable::Map(Kanren::Var, T)) #

[View source]
def is_bound?(var) : Bool #

Return true if the given Var is bound to a value in this State.


[View source]
def redirects #

[View source]
def redirects=(redirects : Immutable::Map(Kanren::Var, Kanren::Var)) #

[View source]
def unify_value(var : Var, value : T) : Iterator(State(T)) #

Return the stream of states in which the given Var has been unified with the given value. If this is logically inconsistent with the current state, the returned stream of states will be empty.


[View source]
def unify_values(a_value : T, b_value : T) : Iterator(State(T)) #

Return the stream of states in which the given two values are unified (constrained to be the same value). If the values are not equal, the returned stream of states will be empty.


[View source]
def unify_vars(a : Var, b : Var) : Iterator(State(T)) #

Return the stream of states in which the given two Vars are unified (constrained to have the same value). If this is logically inconsistent with the current state, the returned stream of states will be empty.


[View source]