about summary refs log tree commit diff
path: root/users/wpcarro/emacs/.emacs.d/wpc/wpc-golang.el
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-02-14T11·01+0100
committerclbot <clbot@tvl.fyi>2022-02-15T12·52+0000
commit36f6322d16ad0c2341bc37235bf327db516ef97d (patch)
tree3c45e82c02f90028879f0ea12a51aeec859c86d2 /users/wpcarro/emacs/.emacs.d/wpc/wpc-golang.el
parent79f93f3d857416f58f779680519a8bd6c99a2fac (diff)
feat(sterni/nix/fun): implement tail call “optimization” for Nix r/3834
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>
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d/wpc/wpc-golang.el')
0 files changed, 0 insertions, 0 deletions