unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: shortcutz <spookygostee@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: strange behavior of mapconcat
Date: Tue, 16 Apr 2024 08:36:41 +0200	[thread overview]
Message-ID: <86ttk1ak5i.fsf@p200300d6272485fa68b269bdf31038f2.dip0.t-ipconnect.de> (raw)
In-Reply-To: <CAJ+V6LGV=LJ0fpevLDT6wuK6PPWwWBg-f=M8x_=sVKp6+NxymQ@mail.gmail.com> (shortcutz's message of "Mon, 15 Apr 2024 10:43:37 -0500")

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



      parent reply	other threads:[~2024-04-16  6:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 15:43 strange behavior of mapconcat shortcutz
2024-04-15 15:57 ` shortcutz
2024-04-16  6:16   ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-04-16  6:36 ` Joost Kremers [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttk1ak5i.fsf@p200300d6272485fa68b269bdf31038f2.dip0.t-ipconnect.de \
    --to=joostkremers@fastmail.fm \
    --cc=help-gnu-emacs@gnu.org \
    --cc=spookygostee@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).