documented my cache
I believe it's nothing, such a small thing. But it was a good idea to document it using .md
Anybody cares to read?
https://github.com/vpatryshev/ScalaKittens
Anybody cares to read?
https://github.com/vpatryshev/ScalaKittens
def cached[K,V](f: K => V) : K => V = {
val cache = new scala.collection.mutable.HashMap[K,V]
k => cache.getOrElseUpdate(k, f(k))
}