[racket] function parameters in racket
I think probably a clearer way is to say this:
(define plus
(lambda xs
(displayln “received: “)
(displayln xs)
(apply + xs)))
http://docs.racket-lang.org/guide/lambda.html#%28part._rest-args%29
On Jul 20, 2014, at 11:33 AM, קוראל אלימלך <coral2301 at gmail.com> wrote:
> thank u very much:)
>
>
> 2014-07-20 18:29 GMT+03:00 Jens Axel Søgaard <jensaxel at soegaard.net>:
> (define (plus . xs) ; notice the . xs . The arguments are passed as a
> list in xs.
> (displayln "received: ")
> (displayln xs)
> (apply + xs))
>
> 2014-07-20 16:07 GMT+02:00 קוראל אלימלך <coral2301 at gmail.com>:
> > how can i define a function that gets a not known number of parameters
> > (like the + function:
> > that i can send (+1 2 ) or (+ 1 2 3 ) (+1 2 3 4 )....)
> >
> > thank u :)
> >
> > ____________________
> > Racket Users list:
> > http://lists.racket-lang.org/users
> >
>
>
>
> --
> --
> Jens Axel Søgaard
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140720/f26430fb/attachment.html>