[Top][All Lists]

[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 <> 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 

(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."


  (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
      (setq rplc (cdr (assoc word aggr)))
      (unless (null rplc)
         (add-to-list 'nscrip
             (replace-regexp-in-string word rplc word)))) ))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]