[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looping lists through mapcar
From: |
Emanuel Berg |
Subject: |
Re: Looping lists through mapcar |
Date: |
Wed, 24 Aug 2022 11:54:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
uzibalqa 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)))) ))
Unheard of :)
--
underground experts united
https://dataswamp.org/~incal
- 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, 2022/08/24
- Re: Looping lists through mapcar,
Emanuel Berg <=
- 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
- Re: Looping lists through mapcar, uzibalqa, 2022/08/25