3 ms·
Very good catch. Any suggestion how I could improve the usage of null for determining the end of a call list?
by LightMachine 11y ago
Very good catch. Any suggestion how I could improve the usage of null for determining the end of a call list?
- lambdapie 11y agoActually there are other problems that are caused by the fact that you're not really doing HOAS, but something even more difficult, namely trying to infer the function by passing in values. For example LJSON.stringify(function(v) { if (v == 0) { return "zero"; } else { return "one"; } }) Evaluates to the string (function(v0){return "one"}) The only way to avoid both these issues, is to inspect the code of a function f using f.toString(). However you would need to consider the scope where f was defined.
- LightMachine 11y agoAh, fair enough. The user should avoid using native JS constructs on the code to be stringified, though - it is an interesting/useful side effect of the method that you are able to, but ideally you would define your functions using only the pure λ-calculus grammar. Thanks for figuring that out!