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

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp,comp.lang.scheme on Wed Jul 9 05:29:47 2025
    From Newsgroup: comp.lang.lisp

    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
    --- Synchronet 3.21a-Linux NewsLink 1.2