(define (name, local-decalre) ..) would lost (args)

For the Compleat Fan

(define (name, local-decalre) ..) would lost (args)

Postby ssqq » Tue Sep 13, 2016 3:41 pm

Code: Select all
> (define (show-args) (println (args)))             
(lambda () (println (args)))                       
> (show-args 1 2 3)                                 
(1 2 3)                                             
(1 2 3)                                             
> (define (show-args,@x) (println (args)))         
(lambda (, @x) (println (args)))                   
> (show-args 1 2 3)                                 
(3)                                                 
(3)                                                 
> (define (show-args @x, @y) (println @x (args)))   
(lambda (@x , @y) (println @x (args)))             
> (show-args 1 2 3)                                 
1()                                                 
()                                                 
>
ssqq
 
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

Re: (define (name, local-decalre) ..) would lost (args)

Postby ssqq » Thu Sep 15, 2016 1:15 am

I think newlisp treat `,` and follow args as extra args, so assign them with nil in default and init in *args stack*.
ssqq
 
Posts: 88
Joined: Sun May 04, 2014 12:49 pm


Return to Anything else we might add?

Who is online

Users browsing this forum: No registered users and 3 guests

cron