all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Task <q01@disroot.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: [NonGNU Elpa] New package: ETT
Date: Wed, 03 May 2023 15:06:13 -0300	[thread overview]
Message-ID: <865y99b824.fsf@disroot.org> (raw)
In-Reply-To: 87a5ylcqq6.fsf@posteo.net

Philip Kaludercic <philipk@posteo.net> writes:

> If that is so, I would explain that in the documentation string, but
> what I wonder is why if condition is needed.  All you basically do is
> avoid converting num1 to a float, and the result remains a integer, in
> some cases.

Oh, I get what you mean now.  Well, back when I coded this I prefered
the result being an integer when the result was exact.  It simplified
some maths for me.  However, nowadays this function is used only four
times in the code, so I probably don't need that fallback anymore.

> While this will calculate the values in constant time,
> 
>   (list (floor time 60) (% time 60))
> 
> a loop will always take more iterations depending on the value of the input:
> 
>   (let ((hr 0))
>     (while (>= time 60)
>       (setq hr (1+ hr)
>              time (- time 60)))
>     (list hr time))

Amazing.  Thanks!

Best regards.



             reply	other threads:[~2023-05-03 18:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 18:06 John Task [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-03 17:14 [NonGNU Elpa] New package: ETT John Task
2023-05-03 18:05 ` Eli Zaretskii
2023-05-03 15:29 John Task
2023-05-03 16:57 ` Sam Steingold
2023-05-03 15:02 John Task
2023-05-03 16:41 ` Philip Kaludercic
2023-05-03 14:07 John Task
2023-05-03 15:55 ` Eli Zaretskii
2023-05-02 21:21 John Task
2023-05-03  6:08 ` Philip Kaludercic
2023-05-03  6:11   ` Philip Kaludercic
2023-05-03  7:12   ` Yuri Khan
2023-05-03 11:12 ` Eli Zaretskii
2023-03-01 18:17 John Task
2023-03-01 17:46 John Task
2023-03-02  4:33 ` Richard Stallman
2023-03-02 10:08   ` Holger Schurig
2023-03-02 14:50 ` q01
2023-03-02 15:55 ` John Task

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=865y99b824.fsf@disroot.org \
    --to=q01@disroot.org \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /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.