From f7114326267545404680af2dbf1a14b20674e433 Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Fri, 3 Jul 2015 12:58:08 -0700 Subject: [PATCH] Updating. --- chapter3/interpreter.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter3/interpreter.coffee b/chapter3/interpreter.coffee index 58e86dc..b5e00c6 100644 --- a/chapter3/interpreter.coffee +++ b/chapter3/interpreter.coffee @@ -12,7 +12,7 @@ class Continuation constructor: (@k) -> invoke: (v, env, kont) -> if nilp cdr v - resume @k, (car v) + @k.resume (car v) else throw "Continuations expect one argument", [v, env, kont] @@ -200,6 +200,9 @@ defprimitive = (name, nativ, arity) -> else throw "Incorrect arity") +defpredicate = (name, nativ, arity) -> + defprimitive name, ((a, b) -> if nativ.call(null, a, b) then true else the_false_value), arity + the_false_value = (cons "false", "boolean") definitial "#t", true @@ -211,9 +214,6 @@ for i in [ definitial i -defpredicate = (name, nativ, arity) -> - defprimitive name, ((a, b) -> if nativ.call(null, a, b) then true else the_false_value), arity - defprimitive "cons", cons, 2 defprimitive "car", car, 2 defprimitive "set-cdr!", setcdr, 2