I'm using a clojure source file as a database, by loading the file modifying it then saving it back to the filesystem. I'm trying to keep things simple.
It would be useful to pretty print it so I could inspect it and make small changes, if necessary. It seems like a rather simple problem, and I only need some line breaks or something simple, some text editors have a problem with 1,000's of characters on one line. The other problem is that if there is an error loading the database Clojure says there's an error on line 1, which is the only line. I'll just code up something simple. Starting from some Scheme or CL code is a good idea. I'll just adapt it to support literal maps, vectors, and such. Thanks for your reply, Paul On 10/11/08, Michel Salim <[EMAIL PROTECTED]> wrote: > > > > On Oct 10, 4:37 pm, "Paul Stadig" <[EMAIL PROTECTED]> wrote: >> I have a "database" that I'm working with that I'm loading using >> >> (def *db* (load-file "path-to-file/db.clj")) >> >> and saving using by basically opening a PrintWriter and using (pr-str >> *db*). >> The output to the file is a clojure data structure, but it is all on one >> line. Is there any existing code for printing out in a formatted way with >> new lines and indents and such? >> > Porting an existing CLisp / Scheme pretty printing tool probably won't > be hard. Is this for printing, or just for better readability? > > Regards, > > -- > Michel Salim > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---