unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: LanX <lanx.perl@googlemail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Reverse pop, return value
Date: Tue, 17 Nov 2009 16:48:31 +0100	[thread overview]
Message-ID: <e01d8a50911170748i6463fc46if39f51df7307d3d2@mail.gmail.com> (raw)
In-Reply-To: <b31145e1-113f-4955-80c1-73ecffd70a05@w19g2000yqk.googlegroups.com>

On Tue, Nov 17, 2009 at 4:32 PM, LanX <lanx.perl@googlemail.com> wrote:
> Hi
>
> I tried to realize a reverse pop which pops from the end of the list,
> but the code get's "lengthy"....
>
> I need to define a local variable to hold the return value... is there
> a more elegant way to do it?
>
>  ----------- M-x ielm
> ELISP> (defun rpop (LIST)
>         "reverse pop"
>         (let
>            ( (ret (car (last LIST))) )
>            (nbutlast LIST 1)
>            ret
>         )
>       )

prog1




  reply	other threads:[~2009-11-17 15:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17 13:11 Remove last element in a list Nordlöw
2009-11-17 14:20 ` LanX
2009-11-17 15:32   ` Reverse pop, return value LanX
2009-11-17 15:48     ` Lennart Borgman [this message]
2009-11-17 16:53     ` David Kastrup
2009-11-17 17:33       ` LanX
     [not found]     ` <mailman.10897.1258472938.2239.help-gnu-emacs@gnu.org>
2009-11-17 17:20       ` LanX
2009-11-17 21:34         ` Barry Margolin
2009-11-18  0:28           ` LanX
2009-11-19 13:41             ` Barry Margolin
2009-11-17 21:26   ` Remove last element in a list Barry Margolin

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e01d8a50911170748i6463fc46if39f51df7307d3d2@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=lanx.perl@googlemail.com \
    /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.
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).