-
Notifications
You must be signed in to change notification settings - Fork 451
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
let memoize cache null result values #2998
Conversation
the current implementation of memoize does not cache null result values. in effect the decorated function f is called multiple times for a given set of parameters if f returns a null value. this MR changed the cache in MemoizedHandler to ensure null values are also stored.
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/memoization.kt
Outdated
Show resolved
Hide resolved
@abendt I don't fully understand why you need an additional |
1 similar comment
@abendt I don't fully understand why you need an additional |
Yes, @serras is right. It would indeed by better to just us |
We were not confident of introducing a map in general in |
# Conflicts: # arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/GeneratorsTest.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current implementation of memoize does not cache null result values.
In effect the memoized function will be called more than once for a given set of parameters, if the function returns null for that set.
this MR changed the cache in MemoizedHandler to ensure null values are also stored.