Oh, I should have search through the ml first ... I see that we came to almost exactly the same code ;-)
So it seems that finally, there are more than persons named "Stuart" that would like to see this function somewhere in clojure or clojure-contrib. I have the following questions : * Concerning the function : the previous post was talking about .. , when I was talking about -> . To be honest, I don't know if there is a difference. I think there is one, in that -> is the generalized version of .., working not only on java instances, but also with any clojure function result ... Should both .. and -> be provided with an equivalent "nil safe" form, or just -> ? * Concerning the correctness of the function presented in the thread you mentioned : note that the version I provided and named (for the moment) ?-> worked also if the very first argument is nil, that is (?-> nil .toUpperCase (.substring 1)) works by returning nil (it seems to me that the versions in the mentioned thread would have thrown a NullPointerException in this case ?) * Concerning the name to give to this function : maybe ->? instead of ?->, if you think we can live with this "violation" to the predicate convention ? * Concerning the namespace where it should reside : clojure.core ? clojure.contrib.core ? clojure.contrib.macros ? something else ? Thanks in advance, -- Laurent 2009/3/12 Stuart Sierra <the.stuart.sie...@gmail.com> > > On Mar 9, 8:12 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote: > > When interacting with java code, and maybe in other pure clojure > situations > > as well (but I have not encountered the case myself), I was faced with > > writing boiler plate code to check whether the return values of a chain > of > > calls to successive instance members were null before continuing ... > > This has been discussed here: > > http://groups.google.com/group/clojure/browse_thread/thread/c4eb149248859a18/aab137e1d9363f67 > > -Stuart Sierra > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---