Clojure Test 4 in coordinate transformation exercise

(let [mock-fn (let [n (atom 0)] 
                  (with-meta 
                    (fn [x y] (swap! n inc) [(* x 2) (* y 2)])
                    {:?_current-ns_?/call-count (fn [] (deref n))})) 
        memoized-transform (memoize-transform mock-fn)]
    (= [2 2] (memoized-transform 1 1))
    (= [4 4] (memoized-transform 2 2))
    (= [2 2] (memoized-transform 1 1))
    (= 3 ((:?_current-ns_?/call-count (meta mock-fn)))))

The following is the Test 4 that I am failing.
I understand that a counter is getting inc everytime I call the function with the same arguments.
In clojure there’s a memoize function which makes this example trivial.
My memoize-transform is just using returning (memoize f) which works.
I do not get why the test is asking for call-count to be 3 when clearly the third call should not be run. The correct check should be
((:?current-ns?/call-count (meta mock-fn)))
returning 2, not 3

I am stuck here also. Same question as teongleong.

Returns a function that memoizes the last result.
I guess it is not to code a generic memorizer, just to remember last call.
So if (f 0 0) and followed with (f 0 0), it will use memorized value.
If (f 1 1) followed with (f 0 0), previous momorized value to be discard.

You may be right. If that’s what’s expected, the instruction should make that clear.

Edit: After re-reading the instruction and doc-string, I see that they actually quite clearly asks to check against the last call. I guess we got distracted by Clojure’s built-in memoize function.

They also use the word memoization whose standard meaning implies caching every previously-computed result, not just the last one.

The description of this question can be made more precise to remove this ambiguity. I have no idea how/where to report this to someone who can actually make the change, though!

Memorization doesn’t imply an unlimited cache. That’s one way to do it. Different implementations may take different approaches to the cache.

You can propose a specific change in this thread and a maintainer may approve and ask for you to open a PR or ask if they should use your proposal to make a PR.