36f6322d16
I've had the notion that builtins.genericClosure can be used to express any recursive algorithm, but a proof is much better than a notion of course! In this case we can easily show this by implementing a function that converts a tail recursive function into an application of builtins.genericClosure. This is possible if the function resolves its self reference using a fixed point which allows us to pass a function that encodes the call to self in a returned attribute set, leaving the actual call to genericClosure's operator. Additionally, some tools for collecting meta data about functions (argCount) and calling arbitrary functions (apply, unapply) are necessary. Change-Id: I7d455db66d0a55e8639856ccc207639d371a5eb8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5292 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> |
||
---|---|---|
.. | ||
cynthia | ||
edef | ||
ericvolp12 | ||
eta | ||
firefly | ||
flokli | ||
grfn | ||
isomer | ||
lukegb | ||
Profpatsch | ||
qyliss | ||
riking | ||
sterni | ||
tazjin | ||
wpcarro | ||
zseri | ||
tvlbot.jpg |