I'm interested to know what the process/priority is on bubbling things up from contrib into the core. Is a discussion under way about going through it all?
I also think it's good to have cross-language conventions sometimes unless there are compelling reasons. For example, "slurp" is, perhaps, marginally better than "read" because it may help express that it reads the whole file. Whereas, in Python, one only knows that "read" reads the whole file when they compare it to the fact that there is "readline()". BUT, basing it on python, yet IMPROVING, I'd advocate for "read-all" and "read-line". Totally consistent AND unambiguous. Unless there is a compelling reason (saving a few chars or being cute don't count) to deviate from read and write, it just makes it needlessly harder for people coming from other languages (IMnsHO) On Tue, Mar 24, 2009 at 11:05 PM, Korny Sietsma <[email protected]> wrote: > It'd be nice to have a macro that worked more like the first example - > "spit" is great for one-liners, but the fact that it opens and closes the > file each time you call it seems a bit painful for anything more complex. > Something that ends up working like: > > (with-out-as "test.txt" > (println "hello") > (println "world")) > > Hmm - I've never written a macro, maybe I should give this a try... > > - Korny > > On Wed, Mar 25, 2009 at 5:10 AM, Stuart Sierra < > [email protected]> wrote: > >> >> On Mar 24, 12:42 pm, Parth Malwankar <[email protected]> >> wrote: >> > user=> (with-open [f (writer (file "test.txt"))] >> > (binding [*out* f] >> > (println "hello world !!!"))) >> >> Or even more simply: >> >> (use 'clojure.contrib.duck-streams) >> (spit "test.txt" "Hello, world!\n") >> >> -Stuart Sierra >> >> > > > -- > Kornelis Sietsma korny at my surname dot com > "Every jumbled pile of person has a thinking part > that wonders what the part that isn't thinking > isn't thinking of" > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
