fix lambda shorthand, update array example

This commit is contained in:
Quentin Leonetti
2019-07-20 20:49:25 +02:00
parent 4d437eaac1
commit 55bff65635
2 changed files with 15 additions and 14 deletions

View File

@@ -69,10 +69,10 @@ function Lisp (input, lib) {
__fn: function (input, context) {
return async function () {
const lambdaArguments = arguments
const keys = input.slice(2).filter(i =>
const keys = [...new Set(input.slice(2).flat(100).filter(i =>
i.type === TYPES.identifier &&
i.value[0] === '%'
).map(x => x.value).sort()
).map(x => x.value).sort())]
const lambdaScope = keys.reduce(function (acc, x, i) {
acc[x] = lambdaArguments[i]
return acc