From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Huchler Newsgroups: gmane.emacs.help Subject: Re: beginnerquestion (nconc) Date: Tue, 21 Mar 2017 17:59:24 +0100 Message-ID: <87shm6d0r7.fsf@mail.de> References: <87shmc1m2u.fsf@mail.de> <87k27nzvo7.fsf@mail.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490115627 8716 195.159.176.226 (21 Mar 2017 17:00:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 21 Mar 2017 17:00:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 21 18:00:23 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqN8p-0001CT-05 for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Mar 2017 18:00:15 +0100 Original-Received: from localhost ([::1]:41492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqN8v-0002zj-3R for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Mar 2017 13:00:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqN8J-0002yO-St for help-gnu-emacs@gnu.org; Tue, 21 Mar 2017 12:59:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqN8G-0007BC-Pg for help-gnu-emacs@gnu.org; Tue, 21 Mar 2017 12:59:43 -0400 Original-Received: from [195.159.176.226] (port=40258 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cqN8G-00079r-Ey for help-gnu-emacs@gnu.org; Tue, 21 Mar 2017 12:59:40 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cqN87-00060h-BW for help-gnu-emacs@gnu.org; Tue, 21 Mar 2017 17:59:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:HWgV81CzPBOfqdvDEEsmrf1WEGU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112623 Archived-At: Stefan Monnier writes: >> (setq sequence (nreverse sequence)) > > In many cases, the (nreverse sequence) is actually returned or used in > so me function call, so there's no need to `setq' it. > > > Stefan Well to give you more context, most of the time I used doitems + push. and push works the "right" way. so no reversing is needed: (dolist (item (append (let-alist kodi-properties .items) nil)) (push (list (spiderbit-get-id item) (vector `(,(spiderbit-get-name item) id ,(spiderbit-get-show-id item)))) tabulated-list-entries)) I could revert here kodi-properties I guess to get in the end what I want? But now I needed a iterator in the alist assigend to the elements: (let* ((items (cdr (assoc 'items kodi-properties)))) (dotimes (number (length items)) (let* ((item (elt items number)) (title (or (spiderbit-get-name item) "None")) (id number)) (push (list `(,id) (vector `(,title id ,id))) tabulated-list-entries)))) (setq tabulated-list-entries (nreverse tabulated-list-entries)) So I would need to reverse here items and number or use something like length - number as index? it just dont feels very natural. I dont know. Stefan