From: Borislav I. <bor...@ko...> - 2004-04-07 04:23:19
|
Hi, I tried using define-macro (i.e. the built in macros) to simplify working with streams thus: > (define-macro (make-stream h t) (cons h (delay t))) (macro make-stream (h t)...) But then: > (define (enum start end) (if (> start end) '() (make-stream start (enum (+ start 1) end)))) SchemeException: expected object of type list (i.e. pair or empty), but got: , " (lambda delay~3 ()...)" at jsint.E.error(E.java:14) at jsint.E.typeError(E.java:24) at jsint.U.toList(U.java:180) at jsint.U.listToVector(U.java:772) at jsint.Scheme.analyze(Scheme.java:487) at jsint.Scheme.analyze(Scheme.java:475) at jsint.Scheme.analyze(Scheme.java:490) at jsint.Scheme.analyze(Scheme.java:473) at jsint.Scheme.analyze(Scheme.java:459) at jsint.Scheme.analyze(Scheme.java:490) at jsint.Scheme.analyze(Scheme.java:490) at jsint.Scheme.analyze(Scheme.java:475) at jsint.Scheme.eval(Scheme.java:434) at jsint.Scheme.eval(Scheme.java:424) at jsint.Scheme.readEvalWriteLoop(Scheme.java:208) at jsint.Scheme.runJscheme(Scheme.java:186) at jsint.Scheme.defaultMain(Scheme.java:149) at jsint.Scheme.main(Scheme.java:124) at jscheme.REPL.main(REPL.java:138) If expand "manually" the macro: (define (enum start end) (if (> start end) '() (cons start (delay (enum (+ start 1) end))))) there is no problem. BTW, it also works with define-syntax macros.. Best, Boris |