[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: what's the best way to do this?

William James

2/29/2016 8:58:00 AM

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) ))

SML:

String.concatWith ":" (map Int.toString [2,3,4]);
===>
"2:3:4"

--
I would hesitate to describe America as a nation at all in 1997, because it is
something very different: a polyethnic federation administered by a single
ruling class.... [T]he accumulated rot in America has now reached a point
where the pillars of society itself are failing. --- Ambrose Evans-Pritchard