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

    From B. Pym@21:1/5 to Pascal Bourguignon on Wed Jul 9 05:29:47 2025
    XPost: comp.lang.scheme

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)