Skip to content

Commit

Permalink
fixed over-handeling variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hugodecasta committed Feb 20, 2020
1 parent 1e54863 commit 70041f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function handle(statement) {
if(!(statement in base)) {
throw 'Base exception: "'+statement+'" not found'
}
return handle(base[statement])
return base[statement]
} else if (typeof statement === 'object') {
let meth = statement[0]
let inner_args = statement.slice(1)
Expand Down
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ test('list define', t => {
t.deepEqual(scheme("(define tot '(+ a b))"), ['+','a','b'])
})

test('list read', t => {
t.deepEqual(scheme("tot"), ['+','a','b'])
})

test('list eval', t => {
t.is(scheme("(define a 5)"), 5)
t.is(scheme("(define b 4)"), 4)
Expand Down

0 comments on commit 70041f9

Please sign in to comment.