Class: Campa::Lisp::Cons
- Inherits:
-
Object
- Object
- Campa::Lisp::Cons
- Defined in:
- lib/campa/lisp/cons.rb
Instance Method Summary collapse
- #call(new_head, list) ⇒ Object
-
#initialize ⇒ Cons
constructor
A new instance of Cons.
Constructor Details
#initialize ⇒ Cons
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 |