[Top][All Lists]

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

Re: Emacs Lisp coding style question

From: Grant Rettke
Subject: Re: Emacs Lisp coding style question
Date: Wed, 2 Jul 2014 09:19:41 -0500

let* is included for a reason and using it is definitely Lispy being
that it is important enough to have its own special form.

It indicates to the reader that the following computations must occur
on the specified order. That is why it exists because as you pointed
out there are other ways of achieving the same thing.

As previously stated, it is definitely a personal preference thing.
Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
address@hidden |
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

On Wed, Jul 2, 2014 at 7:47 AM, Thorsten Jolitz <address@hidden> wrote:
> Hi List,
> sometimes I wondered about the following coding style question, so I
> decided to do it in public:
> Often functions do a lot of work to gather some data and then do a
> rather simple action with the gathered data:
> #+begin_src emacs-lisp
>   (defun foo ()
>     (let* ((x (create-x))
>           (y (create-y))
>           (z (create-z x y))
>           (u (create-u z))
>           (v (create-v))
>           (w (create-w u v)))
>       (simple-action w)))
> #+end_src
> Thats the way I would do it, and I find it easy to write, read and
> understand.
> But (without being able to give concrete examples right now) I noticed
> that advanced Lispers tend to call this 'C-style', consider the let
> bindings unnessesary since the local vars are only used once, and
> prefer this style:
> #+begin_src emacs-lisp
>   (defun foo ()
>     (simple-action
>      (create-w
>       (create-u
>        (create-z (create-x) (create-y)))
>       (create-v))))
> #+end_src
> This looks more 'lispy' and might have a slight performance
> advantage. But when the 'create-xyz' expressions grow in size the
> whole thing might start to look very complicated and it becomes hard to
> recognize that its just about `simple-action' with some gathered
> data.
> What would be the recommended style for Emacs Lisp, or is this just a
> matter of taste?
> --
> cheers,
> Thorsten

reply via email to

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