* Negative nth index @ 2024-12-22 5:43 Anand Tamariya 2024-12-22 7:39 ` Eli Zaretskii 2024-12-22 10:16 ` Andreas Schwab 0 siblings, 2 replies; 4+ messages in thread From: Anand Tamariya @ 2024-12-22 5:43 UTC (permalink / raw) To: Emacs Devel [-- Attachment #1: Type: text/plain, Size: 71 bytes --] Should negative index for nth be valid? e.g. (nth -1 '(1 2)) returns 1 [-- Attachment #2: Type: text/html, Size: 137 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Negative nth index 2024-12-22 5:43 Negative nth index Anand Tamariya @ 2024-12-22 7:39 ` Eli Zaretskii 2024-12-22 9:01 ` Tassilo Horn 2024-12-22 10:16 ` Andreas Schwab 1 sibling, 1 reply; 4+ messages in thread From: Eli Zaretskii @ 2024-12-22 7:39 UTC (permalink / raw) To: Anand Tamariya; +Cc: emacs-devel > From: Anand Tamariya <atamariya@gmail.com> > Date: Sun, 22 Dec 2024 11:13:18 +0530 > > Should negative index for nth be valid? e.g. > (nth -1 '(1 2)) returns 1 What does this do in other Lisps? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Negative nth index 2024-12-22 7:39 ` Eli Zaretskii @ 2024-12-22 9:01 ` Tassilo Horn 0 siblings, 0 replies; 4+ messages in thread From: Tassilo Horn @ 2024-12-22 9:01 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Anand Tamariya, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: >> Should negative index for nth be valid? e.g. >> (nth -1 '(1 2)) returns 1 > > What does this do in other Lisps? In CL, it errors (ditto for nthcdr with negative index). Same for (nth '(1 2 3) -1) in Clojure or (list-ref '(1 2 3) -1) in Scheme. Bye, Tassilo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Negative nth index 2024-12-22 5:43 Negative nth index Anand Tamariya 2024-12-22 7:39 ` Eli Zaretskii @ 2024-12-22 10:16 ` Andreas Schwab 1 sibling, 0 replies; 4+ messages in thread From: Andreas Schwab @ 2024-12-22 10:16 UTC (permalink / raw) To: Anand Tamariya; +Cc: Emacs Devel On Dez 22 2024, Anand Tamariya wrote: > (nth -1 '(1 2)) returns 1 What would (nth -1 '#1=(1 2 . #1#)) return? -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-22 10:16 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-12-22 5:43 Negative nth index Anand Tamariya 2024-12-22 7:39 ` Eli Zaretskii 2024-12-22 9:01 ` Tassilo Horn 2024-12-22 10:16 ` Andreas Schwab
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).