On Jan 26, 2009, at 4:31 PM, BerlinBrown wrote:
I want to output a directory with a similar listing (see below), but only a fixed number of spaces. Is there a clojure approach to already do this.-rw 13290 1216183460872 LispExample_Flow.png -rw 3211 1217537516267 PDFReport.java I think in Common Lisp, the powerful 'format' could make this happen probably in one line. Anyone conjure a clojure approach?
Clojure provides easy access to Java's "format" method via clojure.core/format .
Here's one way to produce fixed width fields: user> (def lines [["-rw" "13290" "1216183460872" "LispExample_Flow.png"] ["-rw" "3211" "1217537516267" "PDFReport.java"]]) #'user/lines user> (doseq [line lines] (println (apply format "%3s %5s %15s %s" line))) -rw 13290 1216183460872 LispExample_Flow.png -rw 3211 1217537516267 PDFReport.java nil user> You may also find clojure.core/printf helpful with this. --Steve
smime.p7s
Description: S/MIME cryptographic signature