Closed phil-r closed 9 years ago
Once is where you want a function to run only once, like a callback that can be invoked from multiple places, whereas memoize is where you want to know the return value of an expensive function like a complex math function, yet only want to do the intensive computation once, and reuse the saved results for further calls
Thank you! Readmes are a bit confusing ;)
I didn't realize the readmes were so similar. To elaborate on what I wrote above, once is more concerned about running the function, so even calling a once
'd function with different arguments shouldn't call it again, in contrast, a memoize
'd function will run for each unique arguments list
Hi, what's the difference between those two exercices?