This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ((cadr lst) (car lst) (caddr lst)) Won't work


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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]