assertEq(memorized_fn("a camel") , "you owe a camel to the bank.") assertEq(fn_call_count , 1) assertEq(memorized_fn("a camel") , "you owe a camel to the bank.") assertEq(fn_call_count , 1) assertEq(memorized_fn("5") , "you owe 5 to the bank.") assertEq(fn_call_count , 2) // from here on, memorization will be halted assertEq(memorized_fn("5") , "you owe 5 to the bank.") assertEq(fn_call_count , 2) assertEq(memorized_fn(5) , "you owe 5 to the bank.") assertEq(fn_call_count , 3) assertEq(memorized_fn("your soul"), "you owe your soul to the bank.") assertEq(fn_call_count , 4) assertEq(memorized_fn("your soul"), "you owe your soul to the bank.") assertEq(fn_call_count , 5) assertEq(memorized_fn("a camel") , "you owe a camel to the bank.") assertEq(fn_call_count , 5)
similar to memorize, but halts its memorization after
n
-unique unmemorized calls are made to the function.Example