Rest of arguments in a function call 
Author Message
 Rest of arguments in a function call

Hi schemers,

Starting with the code :

        (define ll '(1 2 3))
        (define (f . l) (display l) (newline))
        (f . (cdr ll))

I want this last expression to be evaluated as (f 2 3) (ie, I want
(cdr ll) to be evaluated before proceding f).

I know that I can do this in a macro, but I use this kind of thing in
many functions and I don't want a big global macro.

"Never imagine yourself not to be otherwise than what it might appear
to others that what you were or might have been was not otherwise than
what you had been would have appeared to them to be otherwise"
  The Duchess

_Manuel Giraud_

Sat, 10 Jan 2004 00:39:35 GMT  
 Rest of arguments in a function call


>         (f . (cdr ll))

Try this: (apply f (cdr ll))

Sat, 10 Jan 2004 00:57:36 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Calling a function with your &rest

2. VC++ calling fortran function and fortran function calling a c++ function

3. Optional argument and *rest simultaneously

4. Optional argument and *rest simultaneou sly

5. Final SRFI 5: A compatible let form with signatures and rest arguments

6. macros with &rest argument

7. Calling dll functions which need pointers to be passed as an argument

8. calling function as argument

9. function has been called with too many arguments

10. Calling a python function with a list as the input argument from C

11. problem calling functions with default arguments

12. Call a function in DLL with string arguments?


Powered by phpBB® Forum Software