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
I wonder if (at least part of) the problem here is the fact that webppl doesn't bind the name of named function expressions in their body. e.g. ((function f() { return typeof f; })()); evaluates to 'function' in JS and 'undefined' in webppl?
(It's news to me that JS named function expressions do this.)
I think named function expressions generally get misunderstood. Its often sufficient in practice to assign an anonymous function expression to a named variable and use that for recursion and I think this is the most common practice in webppl. It really comes down to the issue of assigning a name to an intermediate expression.
When this is compiled, the factorial function is optimized away because it is invoked immediately. I believe it is because of the condition here:
https://github.com/probmods/webppl/blob/dev/src/transforms/optimize.js#L85
I think it is good to check if the callee has a name, because then it might be used for recursion.
The text was updated successfully, but these errors were encountered: