Skip to content

Commit

Permalink
sets evaluate their elements
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbicodes committed Sep 5, 2023
1 parent 5012010 commit 4aa4196
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function testExercisesUntilFail() {
console.log("Fails:", fails)
}

//testSolution(randExercise())
testSolution(randExercise())
//testSolution("nth_prime")
//loadExercise("all_your_base")
//testExercisesUntilFail()
Expand Down
6 changes: 6 additions & 0 deletions src/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ function eval_ast(ast, env) {
return env.get(ast);
} else if (types._list_Q(ast)) {
return ast.map(function (a) { return EVAL(a, env); });
} else if (types._set_Q(ast)) {
var new_set = new Set()
for (const item of ast) {
new_set.add(EVAL(item, env))
}
return new_set
} else if (types._vector_Q(ast)) {
var v = ast.map(function (a) { return EVAL(a, env); });
v.__isvector__ = true;
Expand Down

0 comments on commit 4aa4196

Please sign in to comment.