Not idiomatic. All Eastwood warnings except for one have some documentation explaining what kinds of things they warn about, and sometimes why they warn about them. The def-in-def warning documentation is available here:
https://github.com/jonase/eastwood#def-in-def As it says there, def's inside other def's are _not_ local. In your example, you will find after defn'ing double-square with the defn square inside that later you can call not only double-square from other functions, but also square, because the defn makes it globally visible (in that namespace, and any others that use or require/refer it). Andy On Sat, Nov 15, 2014 at 8:31 AM, Udayakumar Rayala <uday.ray...@gmail.com> wrote: > <Cross posting from Clojurescript group. Sorry if you got this question > twice> > > Hi, > > Is it idiomatic to have defn inside defn? eastwood throws def-in-def > warning when I have the following code: > > (defn double-square [y] > (defn square [x] (* x x)) > (+ (square y) (square y))) > > The above code is a simplified example to show the problem. In the above > case, square is a function which is local and I dont want it to be shared > outside the context of double-square. > > I can change it to use letfn like below: > > (defn double-square [y] > (letfn [(square [x] (* x x))] > (+ (square y) (square y)))) > > But when you have multiple local functions, it doesnt seem nice to read. > > - Uday. > > -- > 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/d/optout. > -- 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/d/optout.