Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [list]

is for the list object in Lisp programming. A list represents a sequence of zero or more elements. Emacs Lisp relies extensively on the list data structure; it is a fundamental building block. Emacs provides many facilities for building, modifying, extending, and efficiently handling list data structures.

12
votes
1answer
432 views

Why does a constant in `let` change with repeated calls? [duplicate]

Say we have such a foo function: (defun foo (e) (let ((lst '(a b c))) (delq e lst))) Then we use it in following way (sequentially evaluating one by one): (foo 'c) ; => (a b) (foo 'b) ; =&...
2
votes
2answers
84 views

Evaluating symbol in function arguments affected by destructive operations?

While evaluating a function call, the arguments is from left to right. For example, (let ((x '(1 2 3))) (list (nreverse x) x)) ;; => ((3 2 1) (1)) The first argument (nreverse x) evaluates to (...
3
votes
0answers
102 views

When to use quote for lists? Modifying quoted lists in Elisp

The Common Lisp Hyper Spec says: The consequences are undefined if literal objects (including quoted objects) are destructively modified. This is further motivated at the Constant Modification ...
4
votes
2answers
263 views

How can I paste paragraph not to interrupt numbers in list org mode?

In list environment, after I copy several paragraphs, the next item number will change into number 1, How can I deal with that? For example, 1. aaa 2. aaa 3. aaa bbb <---this is what I copied ...
15
votes
1answer
2k views

Is '(a . b) really a list?

I'm really confused with the . notation. Is '(a . b) a list? (listp '(a . b)) returns t but when I want to know its length (length '(a . b)) gives an error Wrong type argument: listp, b. The same is ...
8
votes
2answers
125 views

Proper reinitialization of a list? What is happening under the hood?

I'm teaching myself some more elisp and have encountered the following problem: If I want to reset a list variable it won't get updated after the first evaluation. Here is some example code: (defun ...
5
votes
0answers
121 views

Structure-preserving copying of sequences

The form (cl-copy-tree TREE t) returns a deep-copy of a sequence TREE. The the Common Lisp Hyper Spec explains that copy-tree does not preserve circularities and sharing of substructures. I.e., even ...
3
votes
1answer
171 views

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?
2
votes
1answer
204 views

how to parameterize prompt for interactive/command?

background I had elisp code (in this very small git repo) like (defun bulk-replace-file (filepath) (interactive "FPath to file to bulk-replace: ") (bulk-replace-file-non-interactive filepath) ) ...
1
vote
2answers
61 views

Test whether all elements/symbols of a list are the same (eq)

Project: (1) Push every new this-command onto a list containing any previously pushed this-command. (2) Limit the list to a variable length (e.g., 3 or 5), and chop off the oldest. (3) Compare ...
0
votes
1answer
67 views

Custom function to map through nested lists sorting by time-stamp

In the following example, please assume that we are using time-to-seconds to convert each times-stamp into a decimal representation. I have already converted the time-stamps to seconds in this ...