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

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

Re: ELisp - Making a list from a function returning a number


From: Emanuel Berg
Subject: Re: ELisp - Making a list from a function returning a number
Date: Fri, 18 Dec 2020 15:43:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

steve-humphreys wrote:

> This is my new function
>
> (defun timgrid ()
>
>    (let* ( (tstr 800)
>            (tend 1300)
>            (tpd 34)
>            (i 0)
>            (tim tstr)
>            tim tfr )
>       ;; ----- body of let -----
>       (dotimes (i 4)
>          (message "tim tpd: %d %d" tim tpd)
>          (setq tfr (timfutur tim tpd))
>          (message "tim: %d" tim)
>          ;;(setq tlist (append 'tlist (list tim)))
>          (setq tim tfr)) ))

Please, 

1. use more understandable language. this is Lisp, not
   assembly language...

2. remove blank lines and commented out lines

3. don't use comments that do not add any information (e.g.,
   "body of let" - but that is already plain and true, by
   definition)

4. use the normal indentation space for Elisp, in `elisp-mode'
   two spaces

5. again, don't use `setq' in function bodies when there is no
   need, you already have the vars in let*, do all computation
   there (add more vars if necessary, for clarity, even)

I'm not saying this to be disrespectful, instead trust me that
it will bring your game up A LOT and also people will be more
likely to communicate with you - more, but also better since
you help not only yourself but also anyone reading and
possibly using your code...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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