Memoization in Bosque?
Closed this issue · 2 comments
khoshroomahdi commented
is there memoization in Bosque?
mrkmarron commented
Hi, there is not any memoization support in Bosque. However, we are in the process of landing the changes needed to support pragmas and which will allow us to add memoization without adding explicit code:
#pragma Cache'{size=512, evict=LRU}'
recursive function fib(n: Int): [Int, Int] {
return switch(n) {
case 0 => [0, 0]
case 1 => [1, 1]
case _ => [n, fib[recursive](n - 1).1
+ fib[recursive](n - 2).1]
}
}