Sha256: 652398b30dfb0e5a3939feba2b7042a40ac1ed8c59d55aac34f89f8187582c20
Contents?: true
Size: 462 Bytes
Versions: 1
Compression:
Stored size: 462 Bytes
Contents
class Construct attr_reader :car, :cdr def initialize(car, cdr) @car, @cdr = car, cdr end def construct_list? cdr.construct_list? end def to_array construct_list? ? [car] + cdr.to_array : self end 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forsta-0.0.1 | lib/forsta/construct.rb |