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

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

Re: Defining an array in a let clause.


From: Stefan Monnier
Subject: Re: Defining an array in a let clause.
Date: Mon, 05 Dec 2022 16:44:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>          (mm (nth 1 (decode-time)))    ; minutes
>          (hh (nth 2 (decode-time)))    ; hours

This may end up telling it's 14:59 whereas it's actually 14:00 (because
you were unlucky enough to call the first `decode-time` when it's still
13:59 and the second when we're now 14:00.

Rule of thumb: don't call twice a function unless there's a good reason
for it.  Instead store the result of the first call in a var and then
refer to that var.


        Stefan




reply via email to

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