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

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

Re: print out all members of a list


From: Thierry Volpiatto
Subject: Re: print out all members of a list
Date: Mon, 28 Feb 2011 19:32:30 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/23.2.94 (gnu/linux)

ken <gebser@mousecar.com> writes:

> On 02/28/2011 10:20 AM ken wrote:
>> (car '("one" "two" "three"))
>> 
>> prints out "one" ... the first of the list.  How to print out all
>> elements of the list (in order and with the double quotes around them?
>> I'm actually looking just to substitute something for "car" and not
>> write an entire function.  Or is there no such thing?
>> 
>> Thanks much.
>> 
>
> I've been criticized for my elisp terminology-- and properly so--, so
> let me rephrase:
>
> (car '("one" "two" "three"))
>
> returns a string consisting of the first element (?) of the list.  Is
> there an elisp function which either (1) returns one string for each
> element of the list or (2) returns one string containing all elements of
> the list?
>
> E.g.:
>
> (1) "one" "two" "three"
(loop for i in '("one" "two" "three") do (princ (concat "\"" i "\"" " ")))

> or
>
> (2) "onetwothree"
(mapconcat 'identity '("one" "two" "three") " ")
==>"one two three"

> preferably (1).
>
>
> Thanks again.
>
>
> P.S. It seems strange that elisp has so many ways to manipulate lists,
> but doesn't seem to have this very simple functionality.
Because "one" "two" "three" is unusable in code if not in a container.
(i.e it is three differents objects, but not one)

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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