From: uzibalqa <uzibalqa@proton.me>
To: Jean Louis <bugs@gnu.support>
Cc: uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Looping lists through mapcar
Date: Wed, 24 Aug 2022 11:49:25 +0000 [thread overview]
Message-ID: <jbEfOC4-mKGZMuXVlU8PPa6yhdcgjMYgk3PI2SMfrSDYc2ekoeLRYBVOzMYF4J0hycZQdT_ojEPuAhgC_wfd7ptn_9H4Xk4sH9B8nvaDBjg=@proton.me> (raw)
In-Reply-To: <1EB_FSqN_myTP-fiyYVztBLsWY3ttWCLbc9ghEwFYIXpb_XOd_04K9hulZ8FdD9AWFHKJksveqbcqZmClMYNKSi-0rZRlL-7rDDniaj8vOQ=@proton.me>
Sent with Proton Mail secure email.
------- Original Message -------
On Wednesday, August 24th, 2022 at 11:02 AM, uzibalqa <uzibalqa@proton.me> wrote:
> ------- Original Message -------
> On Wednesday, August 24th, 2022 at 10:52 AM, Jean Louis bugs@gnu.support wrote:
>
>
>
> > * uzibalqa uzibalqa@proton.me [2022-08-24 12:04]:
> >
> > > ------- 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'.
> >
> > I got it now.
> >
> > (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 my-assoc-lists ()
> > (let* ((name "andromeda-assoc-table-")
> > (list '())
> > (counter 1))
> > (while (boundp (intern (concat name (number-to-string counter))))
> > (setq list (append list (symbol-value (intern (concat name (number-to-string counter))))))
> > (setq counter (1+ counter)))
> > list))
> >
> > ;; Testing
> >
> > (my-assoc-lists) ⇒ (("OrycteropusAfer" . "Aardvark") ("VicugnaPacos" . "Alpaca") ("MyrmecophagaTridactyla" . "Anteater") ("Dasypodidae" . "Armadillo") ("TaxideaTaxus" . "Badger") ("Beaver" . "Beaver") ("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 (my-assoc-lists))
> > (setq rplc (cdr (assoc word aggr)))
> > (unless (null rplc)
> > (add-to-list 'nscrip
> > (replace-regexp-in-string word rplc word)))) ))
> >
> > ;; I did not test your function.
> >
> > --
> > Jean
>
>
> I hope your new function does not actually make an additional list, because I want to save
> memory.
Testing your function I am getting
Lisp error: (wrong-type-argument listp ("OrycteropusAfer" . "Aardvark")
next prev parent reply other threads:[~2022-08-24 11:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 12:16 Looping lists through mapcar uzibalqa
2022-08-23 19:13 ` Jean Louis
2022-08-24 5:34 ` uzibalqa
2022-08-24 6:24 ` Jean Louis
2022-08-24 9:03 ` uzibalqa
2022-08-24 9:54 ` Emanuel Berg
2022-08-24 10:52 ` Jean Louis
2022-08-24 11:02 ` uzibalqa
2022-08-24 11:49 ` uzibalqa [this message]
2022-08-24 16:17 ` Jean Louis
2022-08-24 12:08 ` Jean Louis
2022-08-24 11:44 ` Emanuel Berg
2022-08-24 12:09 ` Jean Louis
2022-08-25 10:49 ` uzibalqa
2022-08-25 15:57 ` Jean Louis
2022-08-26 2:48 ` uzibalqa
2022-08-24 12:24 ` uzibalqa
2022-08-25 0:31 ` uzibalqa
2022-08-24 23:56 ` uzibalqa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='jbEfOC4-mKGZMuXVlU8PPa6yhdcgjMYgk3PI2SMfrSDYc2ekoeLRYBVOzMYF4J0hycZQdT_ojEPuAhgC_wfd7ptn_9H4Xk4sH9B8nvaDBjg=@proton.me' \
--to=uzibalqa@proton.me \
--cc=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.