help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp function that performs numeric computations


From: Emanuel Berg
Subject: Re: Elisp function that performs numeric computations
Date: Fri, 21 Jan 2022 12:51:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

fatiparty--- via Users list for the GNU Emacs text editor wrote:

> (defun test (dcur dmax drpt)

All programming: Name the function something that etc etc.

Lisp: We don't name formal parameters the assembly language or
C style ... give them short, but if possible complete names
that are easy to read and write. When in doubt, give them
a complete name that communicates what its purpose or
intended use.

> "Compute brace depth used for brace colouring."

Doc string should have the formal parameter's names in BOLD in
the order they come in the the function definition ...

> (interactive)

Assign the formal parameters with argument values

(interactive "ndepth: \nntop: \nnrepeat: ")
                                           ^ eval me

Use English in the prompt string, if the words feel to long
see if they can be shortened in a natural way (here, e.g. dep,
top, and rep) - the reason one avoids "max" is it also appears
in as the function `max' ...

> (let ( (n dcur) )
>   (message "dcur <= dmax | Typeface: %d" n)
> n)

If there is no computation, renaming it ... why do you
do that?

You use it like this:

(let*((side 2)
      (square (expt side 2) )) ...
  ;; use square here
  )

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]