Module: Heist::Scheme::List
- Defined in:
- lib/heist/parser/nodes.rb
Overview
A List
has an array of cells
, and optionally a tail
if it’s an improper list or a dotted pair.
Instance Method Summary collapse
- #cells ⇒ Object
-
#eval ⇒ Object
Evaluating a
List
produces a HeistCons
object. - #tail ⇒ Object
Instance Method Details
#cells ⇒ Object
49 50 51 |
# File 'lib/heist/parser/nodes.rb', line 49 def cells @cells ||= elements[1].elements[0].elements end |
#eval ⇒ Object
Evaluating a List
produces a Heist Cons
object.
43 44 45 46 47 |
# File 'lib/heist/parser/nodes.rb', line 43 def eval list = Runtime::Cons.construct(cells, true) { |c| c.eval } list.tail.cdr = tail.cell.eval if tail.respond_to?(:dot) list end |
#tail ⇒ Object
53 54 55 |
# File 'lib/heist/parser/nodes.rb', line 53 def tail @tail ||= elements[1].elements[1] end |