Hi Ben,
it seems like this has been broken in Clojure 1.2:
http://groups.google.com/group/clojure/browse_thread/thread/d7141efd4958a7e5/4d847865a9d5fb8b?lnk=gst&q=memoize+fib#4d847865a9d5fb8b

One solution is
(def f (memoize fn [n]...

will do what you want.
Cheers
Andreas

On 29/03/2011, at 10:47 AM, Benny Tsai wrote:

> (defn f [n]
>   (println "f called with" n)
>   (if (zero? n)
>     0
>     (min (f (dec n))
>          (f (dec n)))))
> 
> (def f (memoize f))

--
"Test-driven Dentistry (TDD!) - Not everything should be test driven"
- Michael Fogus
-- 
**********************************************************
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772     Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: andreas.koest...@leica-geosystems.com

************www.leica-geosystems.com*************

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.

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