Hacker News new | past | comments | ask | show | jobs | submit login

That's called memoization and you usually want to leave this decision up to the caller and not the callee since only the caller knows if they are fine with receiving the same value as calculated previously or whether they want a new one each time.



Only relevant if the function isn't pure.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: