[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange behavior of mapconcat
From: |
Joost Kremers |
Subject: |
Re: strange behavior of mapconcat |
Date: |
Tue, 16 Apr 2024 08:36:41 +0200 |
User-agent: |
mu4e 1.12.2; emacs 29.3 |
On Mon, Apr 15 2024, shortcutz wrote:
> In a piece of code I call mapconcat with these arguments:
>
> (mapconcat 'org-no-properties "t" " ")
>
> I'm getting the error (wrong-type-argument sequencep 115). This is the same
> if I use the identity function or any other string instead of "t":
>
> (mapconcat 'identity "t" " ")
> (mapconcat 'identity "string1 string2" " ")
>
> What am I doing wrong? I don't really understand where the 115 is coming
> from. The code is unchanged after macroexpanding, and sequencep says
> "string1 string2" and "t" are both valid sequences.
They are sequences, but sequences of char (which in Emacs is basically just an
int). What's happening is that the function `org-no-properties` is called on
each element of your string, i.e., on each character, separately. But
`org-no-properties` requires a string as argument, not an int. That's where the
error message is coming from: org-no-properties is saying that it requires a
sequence as argument, but it got the integer 115 (the ASCII value of the
character `t`) instead.
--
Joost Kremers
Life has its moments