help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: beginnerquestion (nconc)


From: Stefan Huchler
Subject: Re: beginnerquestion (nconc)
Date: Tue, 21 Mar 2017 17:59:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]