Hi,

On Mar 19, 7:05 am, Greg  Fodor <gfo...@gmail.com> wrote:

> Ah, I think I have the solution:
>
> (defn foo []
>   (let [bar-memoized (memoize bar)]
>     ; Do stuff with bar-memoized
> ))
>
> Seems to work -- to verify, this will GC the memoized cache for bar
> after each call to foo, right?

Yes. I would think so. However, recursive calls in bar to itself will
not be memoised! You could combine this technique however.

(defn foo
  []
  (binding [bar (memoize bar)]
    ...))

This will also catch recursive calls of bar to itself.

Sincerely
Meikel

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to