From: Keith David Bershatsky <esq@lawlist.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 18837@debbugs.gnu.org
Subject: bug#18837: 25.0.50; `sort` -- modify function to preserve original list.
Date: Sat, 25 Oct 2014 22:04:55 -0700 [thread overview]
Message-ID: <m2r3xv4e14.wl%esq@lawlist.com> (raw)
In-Reply-To: <m2tx2rhnfm.wl%esq@lawlist.com>
Thank you, Stefan, for taking a look at this Emacs report (#18837).
Here is my workaround:
(defun lawlist-sort (seq predicate)
(let ((disposable-list (copy-list seq)))
(sort disposable-list predicate)))
There may be situations where `copy-list` might not work, but that is beyond my present level of understanding / knowledge. I suppose that there might be some time consumption issues involved with the function `copy-list` for extremely complex lists, but none of my lists would ever get so large/complex that this would be an issue.
Thanks,
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
At Sat, 25 Oct 2014 22:44:45 -0400,
Stefan Monnier wrote:
>
> > The doc-string for the function `sort` states that `SEQ is modified by
> > side effects`; however, it does not state in what way the original
> > list gets modified or why such a feature might somehow be useful.
>
> The "usefulness" is to avoid allocating another list in the case where
> the unsorted list won't be used later on anyway.
>
>
> Stefan
next prev parent reply other threads:[~2014-10-26 5:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-25 21:03 bug#18837: 25.0.50; `sort` -- modify function to preserve original list Keith David Bershatsky
2014-10-26 2:44 ` Stefan Monnier
2014-10-26 5:04 ` Keith David Bershatsky [this message]
2019-09-16 5:30 ` Stefan Kangas
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=m2r3xv4e14.wl%esq@lawlist.com \
--to=esq@lawlist.com \
--cc=18837@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.