Class: Plasma::Interpreter::DefunNode

Inherits:
PlasmaNode show all
Defined in:
lib/plasma/interpreter/plasma_grammarnode.rb

Instance Method Summary collapse

Methods inherited from PlasmaNode

#empty?

Instance Method Details

#evaluate(env) ⇒ Object



244
245
246
247
248
249
250
# File 'lib/plasma/interpreter/plasma_grammarnode.rb', line 244

def evaluate(env)
  syms = params.syms
  closure = Closure.new(env, syms.slice(1..syms.length), plasma)
  closure.env.merge!(syms[0] => closure)
  env.bind!(syms[0], closure)
  ''
end