From: Dan Davison <davison@stats.ox.ac.uk>
To: Christian Wittern <cwittern@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: problem with mapconcat
Date: Wed, 03 Mar 2010 13:50:34 +0000 [thread overview]
Message-ID: <87y6i94iqd.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <loom.20100303T133307-933@post.gmane.org> (Christian Wittern's message of "Wed, 3 Mar 2010 12:49:17 +0000 (UTC)")
Christian Wittern <cwittern@gmail.com> writes:
> Hi there,
>
> I am trying to build a regex with lisp, which inserts a certain string
> into another string between each character, for example "abc" should
> turn into "a/b/c".
>
> With mapconcat, I think this should work:
>
> (mapconcat 'identity (string-to-list "abc") "/")
>
> since the description for mapconcat says
>
> (mapconcat FUNCTION SEQUENCE SEPARATOR)
>
> However, when I try to evaluate this in Emacs 23.1, here it throws the
> following error:
>
> Debugger entered--Lisp error: (wrong-type-argument sequencep 97)
> mapconcat(identity (97 98 99) "/")
> eval((mapconcat (quote identity) (string-to-list "abc") "/"))
>
> I wonder what I am doing wrong or if there is another way to achieve
> what I am trying to do.
These do it
(mapconcat 'char-to-string (string-to-list "abc") "/")
(mapconcat 'identity (split-string "abc" "" t) "/")
Dan
>
> Any help appreciated,
>
> Christian
next prev parent reply other threads:[~2010-03-03 13:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 12:49 problem with mapconcat Christian Wittern
2010-03-03 13:50 ` Dan Davison [this message]
2010-03-03 13:55 ` Christian Wittern
2010-03-03 13:57 ` Teemu Likonen
2010-03-03 15:23 ` Thamer Mahmoud
2010-03-03 15:41 ` Thamer Mahmoud
2010-03-04 1:39 ` Christian Wittern
2010-03-04 7:36 ` Andreas Röhler
2010-03-04 9:35 ` Stephen Berman
2010-03-04 15:07 ` Andreas Röhler
2010-03-04 6:56 ` Kevin Rodgers
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=87y6i94iqd.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=cwittern@gmail.com \
--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.