diff --git a/chap3.rkt b/chap3.rkt new file mode 100644 index 0000000..c1c42a9 --- /dev/null +++ b/chap3.rkt @@ -0,0 +1,10 @@ +(define (find-symbol id tree) + (call/cc + (lambda (exit) + (define (find tree) + (if (pair? tree) + (or (find (car tree)) (find (cdr tree))) + (if (eq? tree id) (exit #t) #f))) + (find tree)))) + + diff --git a/chapter3/interpreter.coffee b/chapter3/interpreter.coffee index 03e4c1e..8c77e2c 100644 --- a/chapter3/interpreter.coffee +++ b/chapter3/interpreter.coffee @@ -60,7 +60,7 @@ extend = (env, variables, values) -> nil make_function = (variables, body, env, callback) -> - callback (values) -> eprogn body, (extend env, variables, values) + callback (values, cb) -> eprogn body, (extend env, variables, values), cb invoke = (fn, args, callback) -> fn args, callback diff --git a/chapter3/test.coffee b/chapter3/test.coffee new file mode 100644 index 0000000..c756022 --- /dev/null +++ b/chapter3/test.coffee @@ -0,0 +1,6 @@ +{cons} = require "cons-lists/lists" +lisp = require '../chapter3/interpreter' +{read, readForms} = require '../chapter1/reader' +{inspect} = require 'util' + +lisp read('(begin ((lambda () (+ 5 5))))'), (x) -> console.log(x) diff --git a/test-reports.xml b/test-reports.xml new file mode 100644 index 0000000..c3dbab9 --- /dev/null +++ b/test-reports.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +