mondo cleanup
This commit is contained in:
parent
bd93e44154
commit
5d4ef46ac7
1 changed files with 0 additions and 7 deletions
|
|
@ -217,10 +217,6 @@ export class MondoParser {
|
||||||
}
|
}
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
flip_call(children) {
|
|
||||||
let [name, first, ...rest] = children;
|
|
||||||
return [name, ...rest, first];
|
|
||||||
}
|
|
||||||
parse_pair(open_type, close_type) {
|
parse_pair(open_type, close_type) {
|
||||||
this.consume(open_type);
|
this.consume(open_type);
|
||||||
const children = [];
|
const children = [];
|
||||||
|
|
@ -340,7 +336,6 @@ export class MondoRunner {
|
||||||
if (name === 'lambda') {
|
if (name === 'lambda') {
|
||||||
const [_, args, body] = ast.children;
|
const [_, args, body] = ast.children;
|
||||||
const argNames = args.children.map((child) => child.value);
|
const argNames = args.children.map((child) => child.value);
|
||||||
// console.log('lambda', argNames, body.children);
|
|
||||||
return (x) => {
|
return (x) => {
|
||||||
scope = {
|
scope = {
|
||||||
[argNames[0]]: x, // TODO: merge scope... + support multiple args
|
[argNames[0]]: x, // TODO: merge scope... + support multiple args
|
||||||
|
|
@ -354,7 +349,6 @@ export class MondoRunner {
|
||||||
if (arg.type === 'list') {
|
if (arg.type === 'list') {
|
||||||
return this.call(arg, scope);
|
return this.call(arg, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg.type === 'number') {
|
if (arg.type === 'number') {
|
||||||
arg.value = Number(arg.value);
|
arg.value = Number(arg.value);
|
||||||
} else if (['quotes_double', 'quotes_single'].includes(arg.type)) {
|
} else if (['quotes_double', 'quotes_single'].includes(arg.type)) {
|
||||||
|
|
@ -363,7 +357,6 @@ export class MondoRunner {
|
||||||
return this.lib.leaf(arg, scope);
|
return this.lib.leaf(arg, scope);
|
||||||
});
|
});
|
||||||
|
|
||||||
// look up function in lib
|
|
||||||
return this.lib.call(name, args, scope);
|
return this.lib.call(name, args, scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue