You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let list_of_ones : Int -> [Int] = fun n ->
if n == 0 then [] else 1 :: list_of_ones(n-1)
in
let sum : [Int] -> Int = fun l ->
case l
| [] => 0
| x::xs => x + sum(xs)
end
in
let n = 2000 in
sum(list_of_ones(n))
The text was updated successfully, but these errors were encountered:
I checked and list_of_ones is linear, but sum is quadratic.
I suspect it's because of this transition rule (possibly my fault). Specifically is_value:false makes variable lookup take O(n) time.
In order to switch to is_value:true, we are going to have to comb through evaluation rules and convince ourselves that everything that goes into a closure (function arguments, fixpoints, builtins, etc.) is always final; which I suspect isn't true now.
builtin functions are also not currently final, because they have always been stored in the initial environment without a closure (though that should be an easy fix)
The text was updated successfully, but these errors were encountered: