Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: LOOP and "anti-finally"?

25 views
Skip to first unread message

WJ

unread,
Nov 16, 2012, 1:27:46 PM11/16/12
to
Thomas A. Russ wrote:

> > > Example, I want to print a list of numbers seperated by commas except
> > > at the last one which should end with a period and newline.
> >
> > I'd use FORMAT for this particular case:
> >
> > (format t "~&~{~#[~;~D.~:;~D,~]~}~%" '(1 2 3 4))
>
> There is an even simpler format form:
>
> (format t "~&~{~D~^, ~}.~%" '(1 2 3 4))

Clojure:

(clojure.pprint/cl-format nil "~&~{~D~^, ~}.~%" '(1 2 3 4))
1, 2, 3, 4.

Racket

(~a (apply ~a #:separator ", " '(2 3 4)) ".")
"2, 3, 4."
0 new messages