[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Negative nth index
From: |
Teemu Likonen |
Subject: |
Re: Negative nth index |
Date: |
Tue, 24 Dec 2024 08:42:54 +0200 |
User-agent: |
Notmuch/0.38.3+15~g85c1dbd (https://notmuchmail.org) Emacs/30.0.93 (x86_64-pc-linux-gnu) |
* 2024-12-24 00:11:26-0500, Stefan Monnier wrote:
> I don't see a strong argument in favor of making it index from the end
> rather than signal an error. What would the implementation look like?
> Would it be significantly more efficient than doing it "by hand" e.g.:
>
> (let ((l (length X)))
> (nth (if (< i 0) (- l i) i) X))
First test if index (i) is negative and only then run the needed
"length" etc.
--
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
signature.asc
Description: PGP signature
- Negative nth index, Anand Tamariya, 2024/12/22
- Re: Negative nth index, Eli Zaretskii, 2024/12/22
- Re: Negative nth index, Tassilo Horn, 2024/12/22
- Re: Negative nth index,
Teemu Likonen <=
- Re: Negative nth index, Stefan Monnier, 2024/12/24
- Re: Negative nth index, Sebastián Monía, 2024/12/24
- Re: Negative nth index, Pip Cet, 2024/12/24
- Re: Negative nth index, Mattias Engdegård, 2024/12/25
- Re: Negative nth index, Pip Cet, 2024/12/25
- Re: Negative nth index, Mattias Engdegård, 2024/12/25
- Re: Negative nth index, Pip Cet, 2024/12/25
- Re: Negative nth index, Stefan Kangas, 2024/12/25
- Re: Negative nth index, Stefan Monnier, 2024/12/25
- Re: Negative nth index, Stefan Kangas, 2024/12/25