Questions tagged [data-structures]
15 questions
5
votes
1 answer
How do I efficiently copy or move elements from one vector to another?
I'm working on optimizing some Emacs Lisp code that I've written. Part of this code needs to move elements from one vector to another. Currently, I have this code:
(defun copy-elements (source source-begin source-end
…

zck
- 8,984
- 2
- 31
- 65
5
votes
3 answers
How to extract key from hash-table
I have a hash-table (named ztree-line-to-node-table) that stores the line-number and the corresponding absolute-file-name. The absolute-file-name is extracted using (gethash line ztree-line-to-node-table).
Q: How, please, can I extract the…

lawlist
- 18,826
- 5
- 37
- 118
3
votes
1 answer
Interface with Sqlite
I want to manage simple personal databases, like mp3 collections.
I am not aware of any updated lisp object database project working in Emacs (correct me if I am wrong).
So I would turn to Sqlite, because it seems the only viable serverless…

antonio
- 1,762
- 12
- 24
3
votes
1 answer
Emacs native database for fast key/value access?
I would like to do a key -> value lookup for data that may not fit into memory (or simply avoid the overhead of having to load it an keep it in memory).
Does Emacs natively support any kind of database that can be used for fast lookups (like a…

ideasman42
- 8,375
- 1
- 28
- 105
3
votes
1 answer
How do you get data by key from a json list?
I loaded some json data into a string and have elisp parsing it using the json-read-from-string function. Now I want to do is access data from the JSON by key. When I print out the data via message, it looks kind of like a list of lists (with…

chaseme
- 33
- 3
3
votes
1 answer
ELPA archives directory contents: the data structure used?
I just stumbled across the archives directory of my .emacs.d/archives/ . Here's the beginning of .../archives/gnu/archive-contents
(1
(ace-window .
[(0 9 0)
((avy
(0 2 0)))
"Quickly switch windows." single
…

147pm
- 2,907
- 1
- 18
- 39
3
votes
1 answer
What has replaced elib?
Looking for some data structures for elisp, I came across this. But then this warns me off -- without specifying exactly what replaces elib. So where do I get packages to do doubly linked lists?

147pm
- 2,907
- 1
- 18
- 39
2
votes
1 answer
Why aren't these two otherwise identical forms `equal`?
This requires the let-alist package available on the GNU ELPA (built-in in 25.1).
I have the following macro:
(defmacro sx-assoc-let (alist &rest body)
(declare (indent 1) (debug t))
(require 'let-alist)
`(progn
(sx--ensure-site ,alist)
…

Sean Allred
- 6,861
- 16
- 85
2
votes
0 answers
Directed Acyclic Graphs in Emacs Lisp
Emacs Lisp has support for lists (naturally), association lists, and property lists, vectors, and hash tables. Does it have support for directed acyclic graphs (DAGs)?
I have not found a DAG API in the native Emacs, and searching the package…

Matthew Piziak
- 5,958
- 3
- 29
- 77
2
votes
1 answer
Is there a syntax in Elisp for indexed getters and setters?
I want to define a struct for chores
(defstruct chore name sector assignments)
where the assignments slot is a vector with seven positions. I know that the above syntax will generate the getters chore-name, chore-sector and chore-assignments. But I…

Jeff
- 537
- 4
- 13
1
vote
1 answer
String’s Elements Occupy 1/4 Space of Vector’s
In the GNU Emacs Lisp Reference Manual, 6.2 Arrays:
In practice, we always choose strings for such applications, for four reasons:
They occupy one-fourth the space of a vector of the same elements.
How am I supposed to understand the above…

shynur
- 4,065
- 1
- 3
- 23
1
vote
1 answer
Datomic for emacs/elisp
Does emacs/elisp have something equivalent or similar to Clojure's datomic?
What I tried: google emacs datomic
fyi by datomic I'm referring to this: https://en.wikipedia.org/wiki/Datomic

american-ninja-warrior
- 3,773
- 2
- 21
- 40
1
vote
1 answer
Doubly-linked list package
Are there any good packages for Emacs that implement doubly-linked lists? I know I could make them myself, but I'd rather not re-invent the wheel.

Moyamo
- 388
- 2
- 7
0
votes
0 answers
org-element : remove first headline with its drawer
I have a org-element AST of a subtree which I want to make into a separate file. It looks necessarily like
(org-data nil
(headline (...metadata...) ; (a)
(section (...metadata...) ; (b)
…

B. Pillet
- 41
- 3
0
votes
0 answers
Data structure for ELPA archive use of dotted pair
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?…

147pm
- 2,907
- 1
- 18
- 39