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

lib: add feature memoize #1522

Merged
merged 2 commits into from May 26, 2023
Merged

Conversation

michaellilltokiwa
Copy link
Member

Inspired by idiom 315: https://www.programming-idioms.org/idiom/315/memoization

Would be cool to be able to have this as a subfeature of Unary. So we could do fn.memoize to get a memoized version of a Unary.
But the T of memoize is constrained while Unary's T is not.

Copy link
Member

@fridis fridis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, we need this!
Soon, we might want to use tuples to memoize functions with more arguments. So far, I do not have a good idea for how do do this...
Just maybe change the comment asking for equatable constraint.

lib/memoize.fz Outdated Show resolved Hide resolved
@fridis fridis merged commit c3bd667 into tokiwa-software:main May 26, 2023
4 checks passed
@michaellilltokiwa michaellilltokiwa deleted the lib/memoize branch October 11, 2023 09:06
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

Successfully merging this pull request may close these issues.

None yet

2 participants