newLISP Fan Club

Forum => newLISP in the real world => Topic started by: lyl on December 09, 2018, 12:44:27 AM

Title: abbreviation of arguments in function
Post by: lyl on December 09, 2018, 12:44:27 AM
To understand the meaning of function arguments, I give there arguments long names. However, it's so boring to use these long names in function body.

I ttied like this:


(define (f converse-rate-list (define rate converse-rate) )
   body in which "rate" instead of converse-rate-list is use....)


But it fails.

Is there a better way to achievable this goal? That is to say, how to bind a symbol to a argument of function?
Title: Re: abbreviation of arguments in function
Post by: cameyo on December 09, 2018, 07:33:10 AM
(define (f converse-rate-list)
  (local (rate) (setq rate converse-rate-list))
)

I am almost sure that this is not what you are searching for...  :-)

cameyo
Title: Re: abbreviation of arguments in function
Post by: rickyboy on December 09, 2018, 10:19:26 AM
This is the perfect case for a doc string or a comment.


(define (f rate)
  "Given converse rate list `rate`, does ..."
  ... code using rate ...)
Title: Re: abbreviation of arguments in function
Post by: lyl on December 10, 2018, 05:08:56 AM
@rickyboy What? Newlisp has a elisp style? It's a supprise!
Title: Re: abbreviation of arguments in function
Post by: lyl on December 10, 2018, 05:11:16 AM
Quote from: "cameyo"(define (f converse-rate-list)
  (local (rate) (setq rate converse-rate-list))
)

I am almost sure that this is not what you are searching for...  :-)

cameyo


I'd like to have a try this. Thank you.