help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with mapconcat


From: Dan Davison
Subject: Re: problem with mapconcat
Date: Wed, 03 Mar 2010 13:50:34 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]