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
Where function literals are immediately assigned to a variable in a let statement, we could automatically capture their self value. We could also support mutual recursion where multiple literal functions are bound to variables all in the same let statement. For example
let
is_even = (n: int) => if n == 0 then true else is_odd(n - 1) fi,
is_odd = (n:int) => if n == 0 then false else is_even(n - 1) fi;
This wouldn't be a replacement for rec because there are still scenarios where you might want a function literal to be recursive without having to explicitly bind it to a variable with a let statement (i.e. passing it as an argument to another function)
We'd need to ensure that the right hand sides are each only function literals, and arrange to create their all their frames and delegates, before then injecting each delegate into all the others as an additional capture
The text was updated successfully, but these errors were encountered:
Where function literals are immediately assigned to a variable in a let statement, we could automatically capture their self value. We could also support mutual recursion where multiple literal functions are bound to variables all in the same let statement. For example
This wouldn't be a replacement for
rec
because there are still scenarios where you might want a function literal to be recursive without having to explicitly bind it to a variable with a let statement (i.e. passing it as an argument to another function)We'd need to ensure that the right hand sides are each only function literals, and arrange to create their all their frames and delegates, before then injecting each delegate into all the others as an additional capture
The text was updated successfully, but these errors were encountered: