

Ask YC: Questions about defun and lisp in general - Novash

I know this is not the best place to be asking lisp questions so if someone opposes to it, I make this once the single time I do it.<p>I've been reading PG's ACL book, and since coders are restless beings, of course I don't want to read the whole book to understand what went wrong with what I did. See, here at page 15 he defines this nice 'SUM-GREATER' function. It takes 3 arguments and returns true if the sum of the first two is greater than the third. Here it goes:<p>(defun sum-greater (x y z)
  (&#62; (+ x y) z))<p>Not that hard. NOW, I know that the + function can accept any ammount of parameters so I was trying to figure out how to pass a list as one of the first two parameters (or both) and do not crash the function. Passing another sum doesn't count as a solution. What I am looking for is more on the lines of a C "..." parameter type.<p>Now, if I haven't annoyed enough yet, I know there is a mirc channel about lisp somewhere, but on which mirc net? I think I should ask future questions there.
======
ambition
You're right that this is the wrong forum.

Anyway, the syntax you're looking for is &REST

    
    
        (defun x (y &REST zs) (...))
    

Good luck.

~~~
Novash
Thank you. I looked into &REST and all the other ways I can declare parameters
and I didn't think the Lisp defun could be so powerful. It is not a matter of
how I can declare a function anymore but a matter of how I can't.

Where would it be the right forum?

