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: Pascal J. Bourguignon
Subject: Re: print out all members of a list
Date: Tue, 01 Mar 2011 14:10:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Andreas Röhler <address@hidden> writes:

> Am 28.02.2011 16:20, schrieb ken:
>> (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.
>>
>>
>
> and still a form delivering with doublequotes...
>
> (let ((my-list (list "one" "two" "three")))
>     (dolist (elem my-list)
>   (insert (format "\n\"%s\"" elem))))

Why do you write broken code?

    (let ((my-list (list "o\"n\"e" "t\"wo" "th\\\"ree")))
       (dolist (elem my-list)
          (insert (format "\n\"%s\"" elem))))

    "o"n"e"
    "t"wo"
    "th\"ree"


Is it not easier to write code that works?

    (let ((my-list (list "o\"n\"e" "t\"wo" "th\\\"ree")))
       (dolist (elem my-list)
          (insert (format "\n%s" (prin1-to-string elem)))))

    "o\"n\"e"
    "t\"wo"
    "th\\\"ree"


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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