Found the disconnect. As always, a type issue. Dammit.

This commit is contained in:
Ken Elf Mathieu Sternberg 2015-07-01 13:24:45 -07:00
parent 9d9624632a
commit 291f9771f5
4 changed files with 49 additions and 1 deletions

10
chap3.rkt Normal file
View File

@ -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))))

View File

@ -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

6
chapter3/test.coffee Normal file
View File

@ -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)

32
test-reports.xml Normal file
View File

@ -0,0 +1,32 @@
<testsuites name="Mocha Tests">
<testsuite name="Core interpreter #1" tests="13" failures="0" skipped="0" timestamp="Wed, 01 Jul 2015 20:24:26 GMT" time="0.015">
<testcase classname="Core interpreter #1" name="Should handle true statements" time="0.003"/>
<testcase classname="Core interpreter #1" name="Should handle false statements" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle return strings" time="0"/>
<testcase classname="Core interpreter #1" name="Should handle return strings when false" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle equivalent objects that are not intrinsically truthy" time="0"/>
<testcase classname="Core interpreter #1" name="Should handle inequivalent objects that are not intrinsically truthy" time="0"/>
<testcase classname="Core interpreter #1" name="Should handle basic arithmetic" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle some algebra" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle a basic setting" time="0"/>
<testcase classname="Core interpreter #1" name="Should handle a zero arity thunk" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle a two arity thunk" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle a recursive function" time="0.001"/>
<testcase classname="Core interpreter #1" name="Should handle an IIFE" time="0"/>
</testsuite>
<testsuite name="Core interpreter #3" tests="13" failures="0" skipped="0" timestamp="Wed, 01 Jul 2015 20:24:26 GMT" time="0.009">
<testcase classname="Core interpreter #3" name="Should handle true statements" time="0.001"/>
<testcase classname="Core interpreter #3" name="Should handle false statements" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle return strings" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle return strings when false" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle equivalent objects that are not intrinsically truthy" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle inequivalent objects that are not intrinsically truthy" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle basic arithmetic" time="0.001"/>
<testcase classname="Core interpreter #3" name="Should handle some algebra" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle a basic setting" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle a zero arity thunk" time="0.001"/>
<testcase classname="Core interpreter #3" name="Should handle a two arity thunk" time="0"/>
<testcase classname="Core interpreter #3" name="Should handle a recursive function" time="0.001"/>
<testcase classname="Core interpreter #3" name="Should handle an IIFE" time="0"/>
</testsuite>
</testsuites>