4 ms·
Too bad we couldn't just have "nth" and call it a day.
by ghettoimp 9y ago
Too bad we couldn't just have "nth" and call it a day.
- flavio81 9y agoWe do have it, it is called "elt" in Lisp.
- kbp 9y ago> We do have it, it is called "elt" in Lisp. In Common Lisp, ELT is generic over sequences, so it also works on arrays. CL also has a function actually called NTH which is specific to lists; NTH was also in Maclisp, Lisp Machine Lisp, etc with the same meaning (Interlisp had an NTH function but it's what Common Lisp calls NTHCDR (except that Interlisp NTH used 1-based indexing whereas CL NTHCDR uses 0-based)). Emacs Lisp uses the same nth/elt distinction as Common Lisp. Islisp has elt which is generic over sequences, but I believe that it discarded nth.