[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Surprising behaviour of 'append' with strings
From: |
Michael Heerdegen |
Subject: |
Re: Surprising behaviour of 'append' with strings |
Date: |
Sun, 06 Nov 2022 21:33:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
"R. Diez" <rdiezmail-emacs@yahoo.de> writes:
> I need a routine like this:
>
> (my-append
> "1"
> (list "2" "3")
> "4"
> )
>
> The result should be:
> ("1" "2" "3" "4")
(defun my-append (&rest args)
(cl-mapcan (lambda (x) (if (consp x) x (list x)))
args))
> As a bonus, 'my-append' should check that all elements are strings, or
> list of strings (no nested lists, and no other data types).
Use `cl-every' on the result of `my-append' with a `stringp' predicate.
Michael.
- Surprising behaviour of 'append' with strings, R. Diez, 2022/11/06
- Re: Surprising behaviour of 'append' with strings, Eli Zaretskii, 2022/11/06
- Re: Surprising behaviour of 'append' with strings, Jean Louis, 2022/11/06
- Re: Surprising behaviour of 'append' with strings, Emanuel Berg, 2022/11/06
- Re: Surprising behaviour of 'append' with strings, Emanuel Berg, 2022/11/06
- Re: Surprising behaviour of 'append' with strings,
Michael Heerdegen <=