help-gnu-emacs
[Top][All Lists]
Advanced

[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 05:34:09 +0000

------- Original Message -------
On Tuesday, August 23rd, 2022 at 7:13 PM, Jean Louis <bugs@gnu.support> wrote:


> * uzibalqa uzibalqa@proton.me [2022-08-23 15:18]:
> 
> > I would like to pass a number of alists in the form assoc-table-N so that I 
> > can store data
> > in another list named `nscrip'. Would like to manage the lists without 
> > having to list them
> > individually. My idea has been to use mapcar, but the scheme has not worked 
> > out, and the lists
> > are net being passed through the loop.
> 
> 
> I find it difficult to understand your above description. I got
> the idea that you wish to name alists such as assoc-table-1,
> assoc-table-2 and that you put those symbols in a new list.
> 
> ;; (dolist (aggr (list (mapcar #'construct-assoc-table
> ;; (number-sequence 1 8))))
> ;; (setq rplc (cdr (assoc word aggr)))
> ;; (unless (null rplc)
> ;; (add-to-list 'nscrip
> ;; (replace-regexp-in-string word rplc word))))
> 

I give you  an implementation that works, assoc-table-N each being an alist

(dolist (aggr (list assoc-table-1 assoc-table-2 assoc-table-3

But with many lists, this becomes cumbersome to list them all when.  Had a go
at using mapcar on a string that matches the names of the alists.
    









reply via email to

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