Closed danilopedraza closed 1 month ago
I propose this: When you want to memoize a call, you mark it with the save
keyword:
let fib(0) := 0
let fib(1) := 1
let save fib(n) := fib(n - 1) + fib(n - 2) # calls that match this pattern will be memoized
I do not like this word. It could be confusing, I thought,save
just saves the return value of the function. I think It would be better to use a word that makes the user think about the memoization process, not just about saving.
Yeah, I think I will go with memoize
.
This is naively implemented and tested now.
I forgot about memoization. I need to define a syntax to remember previously computed values of a function.