all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Huchler <stefan.huchler@mail.de>
To: help-gnu-emacs@gnu.org
Subject: Re: beginnerquestion (nconc)
Date: Tue, 21 Mar 2017 17:59:24 +0100	[thread overview]
Message-ID: <87shm6d0r7.fsf@mail.de> (raw)
In-Reply-To: jwv37ebpc1a.fsf-monnier+gmane.emacs.help@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> 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




  parent reply	other threads:[~2017-03-21 16:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17  5:58 beginnerquestion (nconc) Stefan Huchler
2017-03-17  7:33 ` Thien-Thi Nguyen
2017-03-17  8:52   ` Thien-Thi Nguyen
2017-03-17 14:19   ` Stefan Huchler
2017-03-17 14:48     ` tomas
2017-03-17 14:42 ` Yuri Khan
2017-03-17 16:59   ` Stefan Huchler
2017-03-17 17:20     ` Drew Adams
2017-03-17 17:32       ` Drew Adams
2017-03-18  2:15     ` Stefan Monnier
2017-03-21 16:47       ` Stefan Huchler
2017-03-21 16:59       ` Stefan Huchler [this message]
2017-03-21 20:14         ` John Mastro
2017-03-22  0:32           ` Stefan Huchler
2017-03-22 15:02             ` Michael Heerdegen
2017-03-22 19:00             ` John Mastro
2017-03-21 11:05     ` Michael Heerdegen

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=87shm6d0r7.fsf@mail.de \
    --to=stefan.huchler@mail.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.