Hi,
I am trying to implement memoize myself and have stucked on one place
for a lot of time. This is the code:

(defn mymemoize [func]
  (let [dict (ref (hash-map))
        inner #((let
                                [val (@dict %)]
              (if (nil? val)
                (do (dosync (alter dict conj {% (func %)})) (println (class
(@dict %))) (@dict %))
                        val)))]
    inner))


(defn gg [x]
        (if (= x 1) 1 2))
(def ff (mymemoize gg))
(ff 1)

I am printing only for debuging purposes. Actually everything in the
do-block is OK, but there is no return value. Why?

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