Description
when using a custom numEncoding
where fromInt
returns a JS function instead of an L
:
zero = 0
throws "term.free is not a function"zero = I 0
works as expected
wrap
calls .free
to determine free variables, but JS Function
s don't have .free
.
When inside a compiled application, .free?.() || []
in A
prevents this behaviour. wrap
should call term.free?.() ?? []
.
ETA: changed not to ?? []
but || new Set
. for some reason, ??
isn't used in other places ( ?.
requires Node 14, so ??
is available ); free
returns a Set
; the only reason []
is used in A
is it's an immediate argument to union
( which returns a Set
but accepts Array
s ), so []
is adequate there, but not here.
L.free
has the same problem ( and the same solution ).
TypeError: term.free is not a function
at wrap (file:///workspace/node_modules/@codewars/lambda-calculus/src/lambda-calculus.js:172:23)