On Wed, 21 Jul 2010 14:47:12 -0700 (PDT)
logan <[email protected]> wrote:

> Lets say I have the following function
> 
> (defn fib[n]
>   (if (> n 2)
>     (+ (fib (- n 2)) (fib (- n 1)))
>     1))
> 
> and I want to memoize it, what is the right way to do it?

Use defn-memo from clojure.contrib.def.

    <mike
-- 
Mike Meyer <[email protected]>             http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

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

Reply via email to