mmore lambda

This commit is contained in:
Sander Hautvast 2021-03-05 14:38:10 +01:00
parent 31918080e4
commit fe0bcd8622

View file

@ -274,7 +274,7 @@ const function_call = function (function_name, argument_exprs) {
if (Object.prototype.hasOwnProperty.apply(functions, [function_name])) { if (Object.prototype.hasOwnProperty.apply(functions, [function_name])) {
return functions[function_name](resolve_arguments(argument_exprs)); return functions[function_name](resolve_arguments(argument_exprs));
} else { } else {
return `unimplemented: ${function_name}(${argument_exprs.map(e=>e.value_type).join(',') })`; return `unimplemented: ${function_name}(${argument_exprs.map(e => e.value_type).join(',')})`;
} }
} }
@ -413,13 +413,11 @@ export const create_vector = function (vector) { //rename to create_vector
} }
const resolve_arguments = function (argument_exprs) { const resolve_arguments = function (argument_exprs) {
let arguments_list = []; return argument_exprs.map(expr => {
for (let i = 0; i < argument_exprs.length; i++) { let value = visit(expr);
let value = visit(argument_exprs[i]); while (value.lazy_expression) {
if (value.lazy_expression) { value = value.get();
value = value.get(); // not convinced this must be here, but where else?
} }
arguments_list.push(value); return value;
} });
return arguments_list;
} }