Questions tagged [mapping]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
39 views

Map each element of a list over every element of another list

Let's assume I've got two lists: ("A" "B" "C" "D") and ("+" "-"). I want to concatenate each element of the first list with every element of the second to get ("A+" "A-" "B+" "B-" ... ). Is there a ...
1
vote
1answer
23 views

How to include an index in a list generated by mapcar?

This statements generates a list of (list filename buf), How could this be written to include an index as well? eg: (list index filename buf) where the index would be a counter, starting at zero, ...
0
votes
1answer
44 views

How can i add same value to every item in list, turning it into alist?

I tried to use this code, but it returns (k k k k k) (mapcar (lambda (x) 'cons x '(k)) '(a b c d e)) What am i doing wrong here? Why doesn't cons work?
4
votes
4answers
272 views

Map function onto nested list?

Q: how can I map a function onto elements of nested lists? For flat lists, we can use mapcar to apply a function to each element of the list: (setq flat '("kittens" "puppies" "otters" "bunnies")) (...
3
votes
4answers
264 views

How to mapcar uneven lists?

I am aware I can use mapcar to join 2 lists into pairs, however all the map functions seem to quit at the shortest list. This for example (cl-mapcar #'concat '("1" "2" "3" "4") '("a" "b" "c")) ...
8
votes
1answer
269 views

Speed up org-map-entries when matching by property

Question: Why is org-map-entries property matching so slow, and what can I do to speed it up? Background: I have a relatively simple use for org-map-entries: grab the effort (in integer minutes) from ...
6
votes
2answers
259 views

Emacs - Understand elisp syntax (mapcar '1+ '(2 4 6))

I saw this example code: (mapcar '1+ '(2 4 6)) ⇒ (3 5 7) But I do not understand '1+ here. it will apply a function to a list but this style obviously not like a function. If means add, the ...
2
votes
0answers
42 views

Do we have anaphoric macros of seq.el?

In dash.el, there are anaphoric macros (it saves to write "lambda": (--map (* it 2) '(1 2)) instead of (-map (lambda (it) (* it 2)) '(1 2))) seq.el is more generic, it works on strings and vectors ...
0
votes
1answer
22 views

Mapping a function over `frame-list` to get a list of the `top` frame-parameter values

I'd like to make a list of parameters of each frame such as the top coordinate, left coordinate, and name to achieve what I asked in my previous question. I'm trying to follow the advice I got there ...
0
votes
1answer
164 views

Remap redo to C-S-/

I do not like the standard keybinding to redo so I would like to customise it. How can I remap redo to C-S-/? I am not able to find any solution in internet.
3
votes
1answer
80 views

Function to allow select a directory and run a command on its files, descending recursively?

I sometimes work on legacy code, and they have mixture of tabs and spaces. I use whitespace-cleanup function in whitespace.el to clean them up. But I have many files, so i want to run the command on ...
6
votes
1answer
1k views

How can I translate my .vimrc into evil-mode

I have heard of the power of Emacs, but I have a ton more experience with vim and an extensive amount of shortcuts in my .vimrc file. I would like to transfer these mappings over to Emacs evil-mode. ...
2
votes
1answer
90 views

Make spaces show as spaces in minibuffer instead of completion

The default mapping of SPC in minibuffer is (self-insert-command N). However, I prefer SPC to simply type a single space (for instance, in passing arguments to environments and commands within AuCTeX)....
10
votes
3answers
587 views

Is there an idiomatic way of reading each line in a buffer to process it line by line?

In Python I'd do the following to process a file line by line: with open(infile) as f: for line in f: process(line) Trying to look up how to do the same in elisp (with buffers instead of ...
8
votes
2answers
2k views

How to apply mapcar to a function with multiple arguments

I have packages variables that have list of github users and package names. (defvar packages '('("auto-complete" . "auto-complete") ("defunkt" . "markdown-mode"))) I want to git ...
17
votes
5answers
1k views

Map a function across a property list?

Q: what is the idiomatic way to map a function across a property list? The various mapping functions (mapcar and family) map a function over a sequence such as a list. How does one use these ...
14
votes
5answers
813 views

How can I map over a vector and get a vector?

The only thing I've found that works is (eval `(vector ,@(mapcar #'1+ [1 2 3 4]))) => [2 3 4 5] but that seems far too complicated to be the 'right' way.