|
|
|
|
|
by TomasSedovic
5251 days ago
|
|
Take a look at the second line in the `apply` definition[1]: self.eval @env[fn][2], Hash[*(@env[fn][1].zip args).flatten(1)]
It's triggered when the `fn` is not callable, i.e. when we pass in lambda: [:lambda, [:x], [:car, [:cdr, :x]]]
The code ignores the `:lambda` symbol (that would be `@env[fn][0]`).It evals the third element of the list (the lambda body) in a new context that combines `@env` and the binding of lambda's args to the symbols in the lambda's definition -- that's what the `Hash` mumbo jumbo creates. [1]: https://github.com/fogus/ulithp/blob/b02d5806ce3b2d3766311c2... |
|