class Construct

Attributes

car[R]
cdr[R]

Public Class Methods

new(car, cdr) click to toggle source
# File lib/forsta/construct.rb, line 4
def initialize(car, cdr)
  @car, @cdr = car, cdr
end

Public Instance Methods

construct_list?() click to toggle source
# File lib/forsta/construct.rb, line 8
def construct_list?
  cdr.construct_list?
end
lisp_eval(environment, forms) click to toggle source
# File lib/forsta/construct.rb, line 16
def lisp_eval(environment, forms)
  if forms.defined?(car)
    # TODO implement and test
  else
    car.lisp_eval(environment, forms).
      call(*cdr.to_array.map { |x| x.lisp_eval(environment, forms) })
  end
end
to_array() click to toggle source
# File lib/forsta/construct.rb, line 12
def to_array
  construct_list? ? [car] + cdr.to_array : self
end