Deutsch   English   Français   Italiano  
<104kuo9$30bp$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: nntp.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: Re: what's the best way to do this?
Date: Wed, 9 Jul 2025 05:29:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <104kuo9$30bp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Wed, 09 Jul 2025 07:29:47 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="09af874846ff096d61ec0669f92ce0f6";
	logging-data="98681"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+/w7bRWUOcY4R16W9OElCw"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:4t2vTOshFGT/TVli5girX0YBKT4=

Pascal Bourguignon wrote:

> > >   (format t "~{~S~^:~}" list)
> 
> > I suspect this is the best LOOP that can be constructed:
> >
> > (loop for item in list
> >       for first = t then nil
> >       if first do (format t "~S" item)
> >       else do (format t ":~S" item))
> 
> If you don't want to use the simple format, you should rather avoid it
> in the loop.
> 
> (when list
>   (loop initially (princ (car list))
>         for item in (cdr list)
>         do (princ ":") (princ item) ))

Gauche Scheme

(define seq '(a b c d))

(when (pair? seq)
  (display (pop! seq))
  (for-each (cut  format #t ":~a" <>) seq))

  ===>
a:b:c:d