function := forms first.
args := forms allButFirst asArray.
- function class = BlockClosure ifTrue: [ ^function value: args ].
- function class = Func ifTrue: [
+ function type = #fn ifTrue: [ ^function fn value: args ].
+ function type = #func ifTrue: [
| env_ |
sexp := function ast.
env_ := Env new: function env binds: function params
argv := OrderedCollection from: (argv collect: [ :arg | MALString new: arg ]).
Core Ns keysAndValuesDo: [ :op :block | replEnv set: op value: block ].
-replEnv set: #eval value: [ :args | MAL EVAL: args first env: replEnv ].
+replEnv set: #eval value: (Fn new: [ :args | MAL EVAL: args first env: replEnv ]).
replEnv set: #'*ARGV*' value: (MALList new: argv).
MAL rep: '(def! not (fn* (a) (if a false true)))' env: replEnv.