Class: Campa::Lisp::Car

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

Instance Method Summary collapse

Constructor Details

#initializeCar

Returns a new instance of Car.



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

def initialize
  @printer = Printer.new
end

Instance Method Details

#call(list) ⇒ Object



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

def call(list)
  return nil if list.nil? || list == List::EMPTY
  raise illegal_argument(list) if !list.is_a?(List)

  list.head
end