[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Elisp - Function returning a sequence of times
From: |
steve-humphreys |
Subject: |
Re: Elisp - Function returning a sequence of times |
Date: |
Wed, 16 Dec 2020 10:40:01 +0100 |
Just made it quick, the focus is on the calculation for the new time.
> Sent: Wednesday, December 16, 2020 at 10:20 AM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: steve-humphreys@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Elisp - Function returning a sequence of times
>
>
> On Wed, Dec 16 2020, steve-humphreys@gmx.com wrote:
> > I have done something like this, but need help to finalise the actual
> > function.
> > Do you agree on this solution?
> >
> >
> > (defun timfutur ()
> > (interactive)
> > (setq tm 845)
> > (setq tsk 30)
> > (setq thr (/ tm 100))
> > (setq tmn (- tm (* thr 100)))
> > (setq tmn-futur (% (+ tmn tsk) 60))
> > (setq thr-futur (% (+ (/ (+ tmn tsk) 60) thr) 24))
> > (message "%d %d %d%d" thr tmn thr-futur tmn-futur))
>
> My humble opinion: try to avoid `setq` at all cost. It has some legitimate
> uses,
> but they're far and few between.
>
> ```
> (defun timfutur ()
> (interactive)
> (let* ((tm 845)
> (tsk 30)
> (thr (/ tm 100))
> (tmn (- tm (* thr 100)))
> (tmn-futur (% (+ tmn tsk) 60))
> (thr-futur (% (+ (/ (+ tmn tsk) 60) thr) 24)))
> (message "%d %d %d%d" thr tmn thr-futur tmn-futur)))
> ```
>
> --
> Joost Kremers
> Life has its moments
>
>
- Re: Elisp - Function returning a list, (continued)
- Re: Elisp - Function returning a list, steve-humphreys, 2020/12/15
- Re: Elisp - Function returning a list, steve-humphreys, 2020/12/16
- Re: Elisp - Function returning a list, Jean Louis, 2020/12/16
- Re: Elisp - Function returning a list, Emanuel Berg, 2020/12/16
- Re: Elisp - Function returning a sequence of times, Jean Louis, 2020/12/16
- Re: Elisp - Function returning a sequence of times, steve-humphreys, 2020/12/16
- Re: Elisp - Function returning a sequence of times, Joost Kremers, 2020/12/16
- Re: Elisp - Function returning a sequence of times,
steve-humphreys <=
- Re: Elisp - Function returning a sequence of times, Michael Heerdegen, 2020/12/16
Re: Elisp - Function returning a list, Emanuel Berg, 2020/12/15