On Tuesday 18 November 2008 08:20:15 mb wrote: > Hi, > > On 18 Nov., 03:01, Adam Jones <[EMAIL PROTECTED]> wrote: > > I'm in the middle of writing some code to extract sql results, which > > means I'm doing a *lot* of forcing right now. It's almost enough for > > me to wish there was a convention (and provided definitions) for > > denoting lazy/strict versions of functions. (e.g. (map f ...) is a > > lazy seq, (map! f ...) is strict) > > For what it's worth: I use the following convention. > > - For code which is purely done for side-effects, I use doseq. eg. > (doseq [x some-seq] (println x)) > > - In case I want to have the seq in memory, or there are side-effects > and I need the actual results, I use doall. > (doall (map some-f some-seq)) > > On the other hand: you can simply create your own map!. > (def map! (comp doall map)) > > Just my 0.02€. > > Sincerely > Meikel
Right, but this is precisely the reason for my asking. I was aware you could create a macro, but if I do that a lot nobody could read my code any longer. Everyone creating his own set of misguided utilities has been an argument against lisp, and I think this is a function of communication inside the community. Using a ! to signify forcing is interesting, even though I am reserved because scheme is using it to signify side effects and clojure is not free from side effects. Anyway, I suppose that doseq is the right idiom for communicating that you want throw away the results. -- Robert Ewald --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---