On Nov 29, 2008, at 9:06 AM, Stephen C. Gilardi wrote:
> > > On Nov 29, 2008, at 8:03 AM, Ralf Bensmann wrote: > >> But #(...) and (fn [] ...) should be the same? > > The other replies have noted why that's not right. > > There is a way to get the effect you were looking for. If you want to > return a constant or do something with side-effects before returning a > value, you can use do: > > #(do nil) is a function that will always return nil > > #(do (prn "hi") 5) will print "hi" and then return 5 > I really dislike the use of do other than for side effects. I imagine a code checker which will eventually flag usage of do et al. Someone did show (fn [] x). If it's somehow important to use #(), please use: #(identity x) Rich --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---