[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looping lists through mapcar
From: |
uzibalqa |
Subject: |
Re: Looping lists through mapcar |
Date: |
Wed, 24 Aug 2022 09:03:32 +0000 |
------- Original Message -------
On Wednesday, August 24th, 2022 at 6:24 AM, Jean Louis <bugs@gnu.support> wrote:
> I cannot understand. Provide exactly what you mean.
Here is what I mean. When I have many alists (`andromeda-assoc-table-N' where
`N' is a numeric value
with say `N' being from 1 to 57), I want to avoid having to write them all down
inside the function
`andromeda-translate'.
(defvar nscrip '())
(defconst andromeda-assoc-table-1
'( ("OrycteropusAfer" . "Aardvark")
("VicugnaPacos" . "Alpaca")
("MyrmecophagaTridactyla" . "Anteater") ))
(defconst andromeda-assoc-table-2
'( ("Dasypodidae" . "Armadillo")
("TaxideaTaxus" . "Badger")
("Beaver" . "Beaver") ))
(defconst andromeda-assoc-table-3
'( ("LynxRufus" . "Bobcat")
("LepomisMacrochirus" . "Bluegill")
("RangiferTarandus" . "Caribou") ))
(defun andromeda-translate ()
"Shorten word at point according to specific rules."
(interactive)
(let* ( (bounds (bounds-of-thing-at-point 'word))
(word (downcase (buffer-substring (car bounds) (cdr bounds))))
(rplc "") )
(goto-char (car bounds))
(add-to-list 'nscrip word)
(dolist (aggr (list andromeda-assoc-table-1
andromeda-assoc-table-2
andromeda-assoc-table-3))
(setq rplc (cdr (assoc word aggr)))
(unless (null rplc)
(add-to-list 'nscrip
(replace-regexp-in-string word rplc word)))) ))
- Looping lists through mapcar, uzibalqa, 2022/08/23
- Re: Looping lists through mapcar, Jean Louis, 2022/08/24
- Re: Looping lists through mapcar, uzibalqa, 2022/08/24
- Re: Looping lists through mapcar, Jean Louis, 2022/08/24
- Re: Looping lists through mapcar,
uzibalqa <=
- Re: Looping lists through mapcar, Emanuel Berg, 2022/08/24
- Re: Looping lists through mapcar, Jean Louis, 2022/08/24
- Re: Looping lists through mapcar, uzibalqa, 2022/08/24
- Re: Looping lists through mapcar, uzibalqa, 2022/08/24
- Re: Looping lists through mapcar, Jean Louis, 2022/08/25
- Re: Looping lists through mapcar, Jean Louis, 2022/08/25
- Re: Looping lists through mapcar, Emanuel Berg, 2022/08/24
- Re: Looping lists through mapcar, uzibalqa, 2022/08/24
- Re: Looping lists through mapcar, uzibalqa, 2022/08/24
- Re: Looping lists through mapcar, Jean Louis, 2022/08/25