r/computerscience • u/dashdanw • May 27 '25
Discussion Does memoizing a function make it truly "idempotent"?
If you cache the result of a function, or say, for instance, check to see if its already been run, and skipping running it a second time make a function truly idempotent?
20
Upvotes
View all comments
Show parent comment
2
u/custard130 May 29 '25
it kinda depends on what the function is doing / what the side effects are
making a function that isnt automatically idempotent behave as if it is, is a little more complicated than just caching the result in many (probably most) situations