From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Demetrios Obenour Newsgroups: gmane.emacs.bugs Subject: bug#16963: A patch to create a list-with-tail primitive. Date: Fri, 07 Mar 2014 08:58:28 -0500 Message-ID: <1394200708.1710.4.camel@localhost.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1394210896 21454 80.91.229.3 (7 Mar 2014 16:48:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Mar 2014 16:48:16 +0000 (UTC) To: 16963@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 07 17:48:24 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 1WLxwd-0002Ug-R4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Mar 2014 17:48:24 +0100 Original-Received: from localhost ([::1]:37335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLxwd-00018s-G1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Mar 2014 11:48:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLxwS-00018L-6C for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 11:48:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLxwJ-0002gQ-Ol for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 11:48:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLxwJ-0002gJ-LH for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 11:48:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WLxwI-00046X-IQ for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 11:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Demetrios Obenour Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Mar 2014 16:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16963 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.139421085515718 (code B ref -1); Fri, 07 Mar 2014 16:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Mar 2014 16:47:35 +0000 Original-Received: from localhost ([127.0.0.1]:55077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WLxvq-00045R-EP for submit@debbugs.gnu.org; Fri, 07 Mar 2014 11:47:34 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57384) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WLvIe-0007PI-TD for submit@debbugs.gnu.org; Fri, 07 Mar 2014 08:58:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLvIW-0002iZ-2g for submit@debbugs.gnu.org; Fri, 07 Mar 2014 08:58:56 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvIV-0002iV-VK for submit@debbugs.gnu.org; Fri, 07 Mar 2014 08:58:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvIN-0003I3-Hp for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 08:58:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLvIF-0002Mk-1m for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 08:58:39 -0500 Original-Received: from mail-qa0-x229.google.com ([2607:f8b0:400d:c00::229]:61567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvIE-0002MW-U0 for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 08:58:30 -0500 Original-Received: by mail-qa0-f41.google.com with SMTP id j5so4068989qaq.28 for ; Fri, 07 Mar 2014 05:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=5Z8xmups80R/SnV00vUqR8rZN2krjHNt0hE5yc2PLyQ=; b=GCOP3uOkQTFQdr9HuMhrGj5ErqnuLOTCAJUXxZxoRC+hlsboAs1rvGlccqA4ABMVOE 7T/H6zaIxXWhBj7rw8UKh8R/Em4ITuKAiJ6QJwxDa0ikkHmPD/OrmRHvsbSAar8Jpa06 a+IP+SWTkinOX8e8VrMAedTchDbmiWJUQ1p/0vw/ePovAFBBq3KhkbT5HrmXS+7mvff2 Y05DF5phnb3JGHWI8HnZEOMVi5SSiRepMghj29D+OwGzfXXRbshyvl0c0OO5iyTcTRAP kD39ZX5YJ72U3HxUnn3p1/d3ZIqEbVOj0jNXLpRdSPr6Wt+MZbiH34+94VLRAHY15wjE rLQw== X-Received: by 10.224.57.142 with SMTP id c14mr3219857qah.23.1394200710027; Fri, 07 Mar 2014 05:58:30 -0800 (PST) Original-Received: from [192.168.200.131] (c-71-236-63-161.hsd1.tn.comcast.net. [71.236.63.161]) by mx.google.com with ESMTPSA id m74sm9997932qgd.14.2014.03.07.05.58.29 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 07 Mar 2014 05:58:29 -0800 (PST) X-Mailer: Evolution 3.10.4 (3.10.4-2.fc20) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 07 Mar 2014 11:47:33 -0500 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:86626 Archived-At: Since a comment in backquote.el said that backquote-list* needed to be a primitive, here is an implementation of it as one, under the name list-with-tail. === modified file 'src/alloc.c' --- src/alloc.c 2014-02-28 21:45:34 +0000 +++ src/alloc.c 2014-03-07 13:27:33 +0000 @@ -2593,6 +2593,26 @@ return val; } +DEFUN ("list-with-tail", Flist_with_tail, Slist_with_tail, 0, MANY, 0, + doc: /* Return a newly created list with specified arguments as elements, +except for the last argument, which becomes the tail of the list. +At least one argument is required. +usage: (list &rest OBJECTS &last TAIL) */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + if (nargs == 0) + error ("Wrong number of arguments"); + register Lisp_Object val; + nargs--; + val = args[nargs]; + + while (nargs > 0) + { + nargs--; + val = Fcons (args[nargs], val); + } + return val; +} DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, doc: /* Return a newly created list of length LENGTH, with each element being INIT. */) @@ -6921,6 +6941,7 @@ defsubr (&Scons); defsubr (&Slist); + defsubr (&Slist_with_tail); defsubr (&Svector); defsubr (&Smake_byte_code); defsubr (&Smake_list); Change Log: This creates a built-in function, list-with-tail, that is identical to backquote-list*-function in backquote.el except that it is a primitive. This follows the suggestion made in a backquote.el Sincerely, Demetrios Obenour