Looks nice.
Have you considered submitting pages like these to the clojure-doc.org site? I
don't know if Michael Klishin would be interested in this material, but it
certainly wouldn't be out of place there if he was willing to take it.
There is a much shorter list of examples here that I wrote a while back:
http://clojuredocs.org/clojure_core/clojure.pprint/cl-format
Regarding the leading zeroes *before* a minus sign for negative numbers, e.g.
like this (last example from the page above):
;; This might look like a bug, but it is actually behavior specified by the
;; Common Lisp HyperSpec mentioned in the docs above. If you don't want that
;; behavior (format "%08d" -2) might suit your purposes better.
user=> (cl-format nil "~8,'0d" -2)
"000000-2"
As the comment above says, the Common Lisp HyperSpec really does specify that
behavior. In particular, read this page word-for-word and you'll see what I
mean:
http://www.lispworks.com/documentation/HyperSpec/Body/22_cbb.htm
It sounds silly to me, but I've verified that several Common Lisp
implementations behave this way. If you want leading zeros for negative
numbers, don't use cl-format.
Andy
On Jan 17, 2013, at 1:38 AM, Rich Morin wrote:
> I've been working on some clojure.pprint wiki pages, with an
> emphasis on documenting cl-format usage:
>
> http://wiki.cfcl.com/bin/view/Projects/Clojure/CP
> http://wiki.cfcl.com/bin/view/Projects/Clojure/CP_snippets
>
> The main page (CP) mostly contains pointers to references.
>
> The CP_snippets page presents a number of (tested!) example
> snippets, grouped by data type (eg, Numbers) and directive
> (eg, ~D). Comments and more examples would be very helpful.
>
> -r
>
> --
> http://www.cfcl.com/rdm Rich Morin
> http://www.cfcl.com/rdm/resume [email protected]
> http://www.cfcl.com/rdm/weblog +1 650-873-7841
>
> Software system design, development, and documentation
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en