From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#18837: 25.0.50; `sort` -- modify function to preserve original list. Date: Sat, 25 Oct 2014 22:04:55 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1414299988 5866 80.91.229.3 (26 Oct 2014 05:06:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2014 05:06:28 +0000 (UTC) Cc: 18837@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 26 06:06:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XiG1z-0004uE-Sj for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Oct 2014 06:06:20 +0100 Original-Received: from localhost ([::1]:55362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiG1z-0007SQ-BW for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Oct 2014 01:06:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiG1p-0007SJ-Jd for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 01:06:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiG1j-0006Wq-BN for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 01:06:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiG1j-0006Wj-33 for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 01:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XiG1i-0005Up-C2 for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 01:06:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Oct 2014 05:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18837 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18837-submit@debbugs.gnu.org id=B18837.141429990821062 (code B ref 18837); Sun, 26 Oct 2014 05:06:02 +0000 Original-Received: (at 18837) by debbugs.gnu.org; 26 Oct 2014 05:05:08 +0000 Original-Received: from localhost ([127.0.0.1]:35648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiG0o-0005Tb-Dn for submit@debbugs.gnu.org; Sun, 26 Oct 2014 01:05:06 -0400 Original-Received: from cobb.liquidweb.com ([50.28.13.150]:34145) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiG0k-0005Sy-Pl for 18837@debbugs.gnu.org; Sun, 26 Oct 2014 01:05:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com; s=default; h=Content-Type:MIME-Version:Cc:Subject:To:From:Message-ID:Date; bh=N5f4SwgA/IFiqj17HJCPKchpXDXnIxdrgFol91rVy+o=; b=ftVbVJJyJf/EBuHBsWzNcem+qx8nbYRstq5/Zw+kgV4YoCncWscWmzLKrC/VcOEqk3kyNH8aKW4XeyxSOhuQgA6Ukdj5bKDH+RRH+bfUSBbBgt8ZjT0cPkhUJsaVY6MW; Original-Received: from cpe-104-173-54-60.socal.res.rr.com ([104.173.54.60]:54732 helo=MP.local) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1XiG0c-0005kc-G6; Sun, 26 Oct 2014 01:04:54 -0400 User-Agent: / () / () APEL/10.8 Emacs/25.0.50 (x86_64-apple-darwin10.8.0) MULE/6.0 (HANACHIRUSATO) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cobb.liquidweb.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-Get-Message-Sender-Via: cobb.liquidweb.com: acl_c_relayhosts_text_entry: lawlist|lawlist.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95095 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