david Posted September 12, 2024 Posted September 12, 2024 Hi, is there the opposite of butlast ? Quote
jesele Posted September 12, 2024 Posted September 12, 2024 (butlast '(1 2 3 4 5)) =>(1 2 3 4) (last '(1 2 3 4 5)) =>(5) (butlast '(1 2 3 4 5) 1) =>(1 2 3 4) (last '(1 2 3 4 5) 1) =>(5) (butlast '(1 2 3 4 5) 3) =>(1 2) (last '(1 2 3 4 5) 3) =>(3 4 5) or from the start (nthcdr 2 '(1 2 3 4 5)) =>(3 4 5) Jesper opmo 1 Quote
born Posted September 13, 2024 Posted September 13, 2024 If the opposite of butlast is "butfirst" then in plain lisp is: (cdr '(1 2 3 4 5)) => (2 3 4 5) or (subseq '(1 2 3 4 5) 1) Achim opmo 1 Quote
AM Posted September 13, 2024 Posted September 13, 2024 or (rest '(1 2 3 4 5)) => (2 3 4 5) or (extended) (car (cdr (cadr (cddr (nthcdr .... CLHS: Accessor CAR, CDR, CAAR, CADR, CDAR... CLHS.LISP.SE nthcdr (Programming in Emacs Lisp) WWW.GNU.ORG nthcdr (Programming in Emacs Lisp) opmo and Stephane Boussuge 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.