all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Chopping the last element of a list
Date: Fri, 29 Apr 2022 07:12:38 +0200	[thread overview]
Message-ID: <YmtzxtmB6n1qKY3i@tuxteam.de> (raw)
In-Reply-To: <VrsNpW7eCNZfvK-l5T2DqhNO2HVHifLmW8Zc7pdXoaa04pjYx1BxgO_0pY6iQtsD8rw1u5o8GoVykKYY38LTSdR2VB_qRKt79lIDLTfmdB4=@protonmail.com>

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Fri, Apr 29, 2022 at 04:26:51AM +0000, emacsq wrote:
> >
> > Here. It returns the last element, and it
> > chops that last element off the list.
> 
> Thanks. It's quite simple and useful  to have along with last/butlast/etc.
> 
> Will you put it into subr.el, so emacs has it built-in ?

Read Drew's code again. Read the examples he provided.

Now, answer this one question: for a list with exactly
one element, say

  (setq foo '(1))

what is its last element? What would you expect choplast
to do? What does Drew's implementation do? Surprise?

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2022-04-29  5:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 21:27 Chopping the last element of a list Drew Adams
2022-04-29  4:26 ` emacsq
2022-04-29  5:12   ` tomas [this message]
2022-04-29 15:55     ` [External] : " Drew Adams
2022-04-30  5:25       ` tomas
2022-04-30 14:47         ` Drew Adams
2022-04-30 14:51           ` tomas
2022-04-29 15:55   ` [External] : " Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2022-04-29  1:02 Drew Adams
     [not found] <fn8q5CKH0JRjvhUBk-weL0eqI0HA5QMHJ7ag-wmP2c_YXYavm1MNiga-Vz77nJCHECfOfW-UdvaTOH2nEAIopin5Nn7mXg2jgOxpVffs4So=@protonmail.com>
2022-04-28  9:21 ` emacsq via Users list for the GNU Emacs text editor
2022-04-28 21:33   ` Michael Heerdegen
2022-04-28 23:52   ` Stefan Monnier via Users list for the GNU Emacs text editor

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=YmtzxtmB6n1qKY3i@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.