Class: MiniKraken::Atomic::KBoolean

Inherits:
AtomicTerm show all
Defined in:
lib/mini_kraken/atomic/k_boolean.rb

Overview

A specialized atomic term that implements a boolean (true/false) value in MiniKraken.

Instance Attribute Summary

Attributes inherited from AtomicTerm

#value

Instance Method Summary collapse

Methods inherited from AtomicTerm

#==, #dependencies, #dup_cond, #eql?, #floating?, #pinned?, #quote, #to_s, #unbound?

Methods inherited from Core::Term

#dup_cond

Constructor Details

#initialize(aValue) ⇒ KBoolean

Initialize a MiniKraken boolean with a given data value.

Examples:

# Initialize with a Ruby boolean
truthy = KBoolean.new(true)
falsey = KBoolean.new(false)
# Initialize with a String inspired from canonical miniKanren
truthy = KBoolean.new('#t')   # In Scheme #t means true
falsey = KBoolean.new('#f')   # In Scheme #f means false
# Initialize with a Symbol inspired from canonical miniKanren
truthy = KBoolean.new(:"#t")   # In Scheme #t means true
falsey = KBoolean.new(:"#f")   # In Scheme #f means false

Parameters:

  • aValue (Boolean, String, Symbol)

    Ruby representation of boolean value.



22
23
24
# File 'lib/mini_kraken/atomic/k_boolean.rb', line 22

def initialize(aValue)
  super(validated_value(aValue))
end