Module: Unific

Defined in:
lib/unific.rb

Defined Under Namespace

Classes: Env, Var, Wildcard

Constant Summary collapse

VERSION =
'0.9'

Class Method Summary collapse

Class Method Details

._Object

Return the Unific wildcard variable



221
222
223
# File 'lib/unific.rb', line 221

def self._
  Unific::Wildcard.instance
end

.failObject

Return false

Placeholder for possible future expansion of failed unification behavior



241
242
243
# File 'lib/unific.rb', line 241

def self.fail
  false
end

.trace(lvl = false) ⇒ Object

Turn on tracing (to STDERR) of Unific operations

The optional level argument sets the verbosity – if not passed, each call to this method increases verbosity



229
230
231
# File 'lib/unific.rb', line 229

def self.trace lvl = false
  Unific::Env::trace lvl
end

.unify(a, b, env = Env.new) ⇒ Object

Unify two terms against an empty environment

See README.rdoc or Env#unify for details

If the two values cannot be unified, ‘false’ is returned. If they can, a new environment is returned which is this environment extended with any new bindings created by unification. – XXX This documentation must be kept in sync with that for Env#unify ++



176
177
178
# File 'lib/unific.rb', line 176

def self.unify a, b, env = Env.new
  env.unify a, b
end

.untraceObject

Turn off tracing (to STDERR) of Unific operations



234
235
236
# File 'lib/unific.rb', line 234

def self.untrace
  Unific::Env::untrace untrace
end