newLISP Fan Club

Forum => Anything else we might add? => Topic started by: ssqq on September 13, 2016, 08:41:00 AM

Title: (define (name, local-decalre) ..) would lost (args)
Post by: ssqq on September 13, 2016, 08:41:00 AM

> (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()                                                
()                                                  
>
Title: Re: (define (name, local-decalre) ..) would lost (args)
Post by: ssqq on September 14, 2016, 06:15:28 PM
I think newlisp treat `,` and follow args as extra args, so assign them with nil in default and init in *args stack*.