On Tue, Mar 29, 2011 at 8:31 AM, Benny Tsai <[email protected]> wrote:
> Just out of curiosity, does "memoize" in 1.3 behave like the current 1.2
> version or the 1.1 version?
user=> (clojure-version)
"1.3.0-alpha4"
user=> (defn f [n]
(println "f called with" n)
(if (zero? n)
0
(min (f (dec n))
(f (dec n)))))
(def f (memoize f))#'user/f
user=> user=> (f 2)
#'user/f
f called with 2
f called with 1
f called with 0
0
user=> (f 2)
0
user=> (f 3)
f called with 3
0
user=>
(so it works the way you expect)
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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