all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: ELisp - Making a list from a function returning a number
Date: Fri, 18 Dec 2020 15:43:28 +0100	[thread overview]
Message-ID: <87ft4318fj.fsf@zoho.eu> (raw)
In-Reply-To: trinity-3da3917f-fb5f-4faa-89ed-d44e6c7fa724-1608260486029@3c-app-mailcom-bs11

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	other threads:[~2020-12-18 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 11:42 ELisp - Making a list from a function returning a number steve-humphreys
2020-12-18  2:26 ` steve-humphreys
2020-12-18  3:01   ` steve-humphreys
2020-12-18 14:43     ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2020-12-18 17:53       ` Jean Louis
2020-12-20  5:03         ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  6:23           ` Jean Louis
2020-12-20  6:30             ` Christopher Dimech
2020-12-20  7:01             ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft4318fj.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.