0

As a belated follow-up to this, can someone enlighten me why the data structure used in the ELPA archive-contents files is a dotted pair of a name (symbol) and a vector that contains a great many things?

What is the advantage of doing it this way? It seems too intentional to just be a random stab. What precedent is this building on?

(1
 (ace-window .
         [(0 9 0)
          ((avy (0 2 0)))
          "Quickly switch windows." single
          ((:url . "https://github.com/abo-abo/ace-window")
           (:keywords "window" "location"))])
Drew
  • 75,699
  • 9
  • 109
  • 225
147pm
  • 2,907
  • 1
  • 18
  • 39
  • This is nearly a dup of https://emacs.stackexchange.com/questions/31107/elpa-archives-directory-contents-the-data-structure-used, and like that question it is too broad or primarily opinion-based. To get the skinny about such a design decision my suggestion would be to ask its author. (And again, Reddit is maybe a good place to ask such a question.) – Drew Jun 21 '19 at 22:58
  • I can't comment on the vector structure, but I'll just add that a list of dotted pairs is an association list; so once that structure has been read, the vector for `ace-window` could be obtained with `(cdr (assq 'ace-window ALIST))` – phils Jun 22 '19 at 01:13
  • That was my question -- where I did not ask this particular question. I now want to know why this particular strategy. It seems too unique to be just some shoot-from-the-hip thing. If anyone has seen it before, please enlighten me. Yes, phils, I'm beginning to guess that a `(cdr (assq 'ace-window THELIST)) would deliver the vector, but that's my question: what advantage is gained here by using a vector instead of just more nested lists? Other ELPA repos use the same strategy as well. Over in Clojure I've heard they encourage vectors and arrays. Is this faster, better? – 147pm Jun 22 '19 at 03:55
  • Vectors (along with other array types) provide constant-time access to their elements (unlike lists, which have linear time access); so yes, there are benefits to using vectors when they are suitable. Refer to `C-h i g (elisp)Sequences Arrays Vectors` – phils Jun 23 '19 at 01:07

0 Answers0