Class: Campa::Lisp::Cons

Inherits:
Object
  • Object
show all
Defined in:
lib/campa/lisp/cons.rb

Instance Method Summary collapse

Constructor Details

#initializeCons

Returns a new instance of Cons.



4
5
6
# File 'lib/campa/lisp/cons.rb', line 4

def initialize
  @printer = Printer.new
end

Instance Method Details

#call(new_head, list) ⇒ Object



8
9
10
11
12
# File 'lib/campa/lisp/cons.rb', line 8

def call(new_head, list)
  raise illegal_argument(list) if !list.is_a?(List)

  list.push(new_head)
end