chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Fwd: eval works different in Chicken 4.7 from 3.4?


From: Matt Welland
Subject: [Chicken-users] Fwd: eval works different in Chicken 4.7 from 3.4?
Date: Mon, 3 Oct 2011 07:34:37 -0700

Oops, didn't copy chicken-users...
---------- Forwarded message ----------
Thanks for taking a look Christian and yes, I did hose the cut 'n paste. I've modified the example to better reflect the usage and here is what I get with compiled code:

Chicken 3.3:
> ./test
((Hello 3rd one))

Chicken 4.7:
> ./test

Error: unbound variable: conc

        Call history:

        test.scm:9: open-input-file
        test.scm:15: port-map
        test.scm:15: read
        <syntax>          (list (h2 "Hello " (foo 1 2) "rd one"))
        <syntax>          (h2 "Hello " (foo 1 2) "rd one")
        <syntax>          (foo 1 2)
        <eval>    (list (h2 "Hello " (foo 1 2) "rd one"))
        <eval>    (h2 "Hello " (foo 1 2) "rd one")
        <eval>    (foo 1 2)     <--

Here is the modified code:
test.scm
(use ports)
(define (h2 . a)
  (apply conc a))
(define (foo a b)
  (+ a b))
(define res (let* ((p (open-input-file "view.scm")))
               (map (lambda (x)
                  (cond
                    ((list? x) x)
                    ((string? x) x)
                    (else '())))
                 (port-map eval (lambda ()(read p))))))
(print res)

and view.scm:
(list
  (h2
  "Hello " (foo 1 2) "rd one"))



On Mon, Oct 3, 2011 at 1:14 AM, Christian Kellermann <address@hidden> wrote:
* Christian Kellermann <address@hidden> [111003 10:11]:
> view.scm:
> (define foo (+ 1 2))
> (print foo)
>
> and then the interpreter:
> $ csi -nq test.scm
> 3
> #;1>
>

I forgot to add the interesting part:
#;1> foo
3

Cheers,

Christian

--
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]