unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: print out all members of a list
Date: Tue, 01 Mar 2011 19:39:16 +0100	[thread overview]
Message-ID: <4D6D3D54.1080401@easy-emacs.de> (raw)
In-Reply-To: <87y64zvvf0.fsf@kuiper.lan.informatimago.com>

Am 01.03.2011 14:10, schrieb Pascal J. Bourguignon:
> Andreas Röhler<andreas.roehler@easy-emacs.de>  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"
>
>

Ok, thanks, interesting point.

 From there `concat' read better for me

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

(?) :-)






  parent reply	other threads:[~2011-03-01 18:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 15:20 print out all members of a list ken
2011-02-28 16:50 ` Teemu Likonen
2011-02-28 17:21 ` ken
2011-02-28 18:25   ` print out all members of a list, v.1.0 ken
2011-02-28 18:32   ` print out all members of a list Thierry Volpiatto
2011-02-28 20:26   ` PJ Weisberg
     [not found]   ` <mailman.5.1298917525.1451.help-gnu-emacs@gnu.org>
2011-02-28 21:32     ` print out all members of a list, v.1.0 Tim X
2011-03-01  5:48     ` Pascal J. Bourguignon
2011-03-01  6:02     ` rusi
2011-03-02  4:51       ` Barry Margolin
2011-03-02  5:33         ` rusi
2011-03-02 11:56         ` Pascal J. Bourguignon
2011-03-03  0:36           ` Barry Margolin
2011-03-03  9:02             ` Pascal J. Bourguignon
2011-03-03 15:37               ` rusi
2011-03-03 16:00                 ` Pascal J. Bourguignon
2011-03-04  2:34               ` Barry Margolin
2011-03-04  4:09                 ` Drew Adams
2011-03-04 10:39                 ` Pascal J. Bourguignon
2011-03-04 11:06                   ` David Kastrup
2011-03-05  3:24                   ` Barry Margolin
     [not found] ` <mailman.0.1298913700.1451.help-gnu-emacs@gnu.org>
2011-03-01  5:41   ` print out all members of a list Pascal J. Bourguignon
2011-03-01 11:33 ` Andreas Röhler
2011-03-01 11:44 ` Andreas Röhler
     [not found] ` <mailman.5.1298979610.15512.help-gnu-emacs@gnu.org>
2011-03-01 13:10   ` Pascal J. Bourguignon
2011-03-01 14:45     ` Stefan Monnier
2011-03-01 14:50     ` Le Wang
2011-03-01 15:10     ` Richard Riley
2011-03-01 18:39     ` Andreas Röhler [this message]
     [not found] <mailman.4.1298906433.17550.help-gnu-emacs@gnu.org>
2011-02-28 15:24 ` Marc Mientki

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=4D6D3D54.1080401@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --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.
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).