Indeed with Common Lisp format, it is a one liner: (cl-format true "~{~{~3A ~...@a ~...@a ~A~%~}~}" lines)
produces: -rw 13290 1216183460872 LispExample_Flow.png -rw 3211 1217537516267 PDFReport.java (nicely aligned in a fixed-width font) CL format is available for Clojure at: http://github.com/tomfaulhaber/cl-format A slightly nicer display is possible if we turn the number strings into numbers: (defn convert-nums [[a b c d]] [a (Long/parseLong b) (Long/parseLong c) d]) (cl-format true "~{~{~3A ~8:D ~18:D ~A~%~}~}" (map convert-nums lines)) produces: -rw 13,290 1,216,183,460,872 LispExample_Flow.png -rw 3,211 1,217,537,516,267 PDFReport.java (again, nicely aligned in fixed-width) Whether all of this is better or worse than the doseq/apply version is a matter of personal taste. I happen to like the destructuring in the format string. Others find it opaque and prefer to iterate explicitly over the structures. On Jan 26, 1:31 pm, BerlinBrown <berlin.br...@gmail.com> 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? > > Basically, I need output with a fixed number of columns, I guess I use > an 'array' of 20 spaces and then fill then fill the array with > content. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---