Class: Campa::Lisp::Defun

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

Instance Method Summary collapse

Constructor Details

#initializeDefun

Returns a new instance of Defun.



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

def initialize
  @printer = Printer.new
  @label_fn = Label.new
end

Instance Method Details

#call(label, params, *body, env:) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/campa/lisp/defun.rb', line 13

def call(label, params, *body, env:)
  raise label_error(label) if !label.is_a?(Symbol)

  label_fn.call(
    label,
    invoke_lambda(params, body),
    env: env
  )
end

#macro?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/campa/lisp/defun.rb', line 9

def macro?
  true
end