Hi all.
Is it not recommended to use defn within defn?

Normal function is faster than the function which has inner function
which actually doesn't run.
------------------------------------------------------------------------------
(defn aaa1 []
  (defn bbb [] 1)
  1)

(defn aaa2 [] 1)

user> (time (dotimes [_ 10000000] (aaa1)))
"Elapsed time: 4083.291 msecs"
nil
user> (time (dotimes [_ 10000000] (aaa2)))
"Elapsed time: 58.34 msecs"
nil
------------------------------------------------------------------------------
In scheme's case both code have been excuted in the same time.

None of clojure code I have seen have inner function.
I like inner function because it doesn't consume a name from namespace
and make it clear that inner function is only used by outer function.
Thanks.

-- 
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

Reply via email to