This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: ((cadr lst) (car lst) (caddr lst)) Won't work
- From: Weiqi Gao <weiqigao at gmail dot com>
- To: kawa at sourceware dot org
- Date: Wed, 12 Jun 2013 21:06:00 -0500
- Subject: Re: ((cadr lst) (car lst) (caddr lst)) Won't work
- References: <CAKZUWfg5L79gUy7_meaqBR=R0nR+NRny-5pbsZR0qSpA=NfXNQ at mail dot gmail dot com>
On Jun 12, 2013, at 8:18 PM, Morven Sun <sunixm@gmail.com> wrote:
> After I defined (define lst '(1 + 2)),
> ((cadr lst) (car lst) (caddr lst)) would not work as (+ 1 2), but
> gives the error msg:
> Argument '+' to 'apply-to-args' has wrong type
Doing what you suggested in another Scheme (Dr Scheme) caused a similar error:
> (define lst '(1 + 2))
> ((cadr lst) (car lst) (caddr lst))
. . application: not a procedure;
expected a procedure that can be applied to arguments
given: '+
arguments...:
1
2
> Well, I'm a little frustrated. Isn't Kawa a Scheme dialect at all? Why
> it's so different from Scheme?
Essentially (cadr lst) is a '+ not a +. You have to evaluate it to get the procedure. So
((eval (cadr lst)) (car lst) (caddr lst))
would have worked.
> It feels too bad that my Scheme knowledge is a little helpless.
Kawa is a pretty faithful Scheme, and you can do a lot with it.
--
Weiqi Gao (éäå)
weiqigao@gmail.com
http://weiqigao.blogspot.com/