Implement a function `memoize : (a -> b) -> (a -> b)`
Sigiloso
I got stuck a bit before I figured out that I cannot do it in Haskell easily and safely and I was unsure about using unsafe features or monads. So I just switched to JavaScript. I coded my memoization function to set up a lexically scoped hash-based cache of function results plus an inner closure using this cache.