Skip to content

Commit

Permalink
remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbicodes committed Sep 5, 2023
1 parent befac7f commit c380999
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function testExercisesUntilFail() {
console.log("Fails:", fails)
}

testSolution(randExercise())
//testSolution(randExercise())
//testSolution("f")
//loadExercise("all_your_base")
//testExercisesUntilFail()
//testExercises()
testExercises()
10 changes: 2 additions & 8 deletions src/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,14 @@ function _EVAL(ast, env) {
case "discard-form":
return null
case "dispatch":
//console.log("eval dispatch")
// Regex
if (types._string_Q(a1)) {
const re = new RegExp(a1, 'g')
return re
return new RegExp(a1, 'g')
}
// Anonymous function shorthand
if (types._list_Q(a1)) {
let fun = [types._symbol('fn')]
var args = Array.from(new Set(ast.toString().match(/%\d?/g))).map(x => types._symbol(x))
let body = ast.slice(1)[0]
fun.push(args)
fun.push(body)
return types._function(EVAL, Env, body, env, args);
return types._function(EVAL, Env, a1, env, args);
}
case "def":
var res = EVAL(a2, env);
Expand Down

0 comments on commit c380999

Please sign in to comment.