Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Once and memoize #35

Closed
phil-r opened this issue Oct 8, 2015 · 3 comments
Closed

Once and memoize #35

phil-r opened this issue Oct 8, 2015 · 3 comments

Comments

@phil-r
Copy link

phil-r commented Oct 8, 2015

Hi, what's the difference between those two exercices?

@kolodny
Copy link
Owner

kolodny commented Oct 8, 2015

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

@phil-r
Copy link
Author

phil-r commented Oct 8, 2015

Thank you! Readmes are a bit confusing ;)

@phil-r phil-r closed this as completed Oct 8, 2015
@kolodny
Copy link
Owner

kolodny commented Oct 9, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants