Yes, I'd consider this bad style, for one, you don't get the arglists metadata showing the names of variables during a repl session. That metadata is on the var, and not the function itself. I'm not familiar with Math/pow's function signature off the top of my head.
I would consider it only in the specific case where you want a computation to happen at compile-time, perhaps by calling a function that returns a function (core.memoize, for instance). The work to set up the cache is done during namespace initialization and never after. On Mon, Nov 25, 2013 at 4:18 PM, Frank Hale <frankh...@gmail.com> wrote: > Given the following code snippet would declaring a Var with an anonymous > function be considered bad style? Would there be any real use cases where > this would be regarded as a cleaner mechanism to declare a function rather > than declaring one with defn? > > user=> (def pow #(Math/pow %1 %2)) > #'user/pow > user=> (pow 2 4) > 16.0 > > -- > -- > 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 > Note that posts from new members are moderated - please be patient with > your first post. > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.