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.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to