class Campa::Lisp::LambdaFn
Attributes
printer[R]
Public Class Methods
new()
click to toggle source
# File lib/campa/lisp/lambda_fn.rb, line 4 def initialize @printer = Printer.new end
Public Instance Methods
call(params, *body, env:)
click to toggle source
# File lib/campa/lisp/lambda_fn.rb, line 12 def call(params, *body, env:) raise parameters_error(printer.call(params)) if !params.respond_to?(:find) validate_params(params) Lambda.new(params, body, env) end
macro?()
click to toggle source
# File lib/campa/lisp/lambda_fn.rb, line 8 def macro? true end
Private Instance Methods
parameters_error(param, expected = "list of symbols")
click to toggle source
# File lib/campa/lisp/lambda_fn.rb, line 23 def parameters_error(param, expected = "list of symbols") Error::Parameters.new(param, expected) end
validate_params(params)
click to toggle source
# File lib/campa/lisp/lambda_fn.rb, line 27 def validate_params(params) invalid_param = params.find { |el| !el.is_a?(Symbol) } raise parameters_error(invalid_param, "symbol") if !invalid_param.nil? end