Re: [Chicken-users] understanding eval
On Fri, Feb 22, 2008 at 09:22:36PM +0900, Daishi Kato wrote: Hi, This might be a stupid question, but would someone help me understand the following eval example? I was expecting to get 1. You're evaluating (car (1 2 3)) You want to be evaluating (car (list 1 2 3)) or (car (quote (1 2 3))) 8--8--8--8--8--8--8--8-- CHICKEN Version 2.732 - linux-unix-gnu-x86 [ manyargs dload ptables applyhook cross ] (c)2000-2007 Felix L. Winkelmanncompiled 2007-12-04 on spirits (Linux) #;1 (define a 'car) #;2 (define b '(1 2 3)) #;3 (eval (list a b)) Error: call of non-procedure: 1 Call history: syntax(eval (list a b)) syntax(list a b) eval (eval (list a b)) eval (list a b) syntax(car (1 2 3)) syntax(1 2 3) eval (car (1 2 3)) eval (1 2 3) -- Cheers, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth pgpMInQgMbwFF.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] understanding eval
OK, so that was stupid. How about this? (define a 'values) (define b '((1 2 3) #(4 5 6)) I'd like to evaluate (values '(1 2 3) '#(4 5 6)) using eval, a and b. --daishi At Fri, 22 Feb 2008 13:29:55 +0100, Peter Bex wrote: On Fri, Feb 22, 2008 at 09:22:36PM +0900, Daishi Kato wrote: Hi, This might be a stupid question, but would someone help me understand the following eval example? I was expecting to get 1. You're evaluating (car (1 2 3)) You want to be evaluating (car (list 1 2 3)) or (car (quote (1 2 3))) 8--8--8--8--8--8--8--8-- CHICKEN Version 2.732 - linux-unix-gnu-x86 [ manyargs dload ptables applyhook cross ] (c)2000-2007 Felix L. Winkelmanncompiled 2007-12-04 on spirits (Linux) #;1 (define a 'car) #;2 (define b '(1 2 3)) #;3 (eval (list a b)) Error: call of non-procedure: 1 Call history: syntax(eval (list a b)) syntax(list a b) eval (eval (list a b)) eval (list a b) syntax(car (1 2 3)) syntax(1 2 3) eval (car (1 2 3)) eval (1 2 3) -- Cheers, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] understanding eval
On Fri, Feb 22, 2008 at 09:57:42PM +0900, Daishi Kato wrote: OK, so that was stupid. How about this? (define a 'values) (define b '((1 2 3) #(4 5 6)) I'd like to evaluate (values '(1 2 3) '#(4 5 6)) using eval, a and b. More of the same: (eval (cons a (map (cut list 'quote ) b))) HTH, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth pgpJtM9M93QLR.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users