tvl-depot/tvix/eval/src/tests/tvix_tests/eval-okay-closure-self.nix
Vincent Ambo ae531a2245 feat(tvix/eval): implement capture of self-recursive upvalues
With this change, it becomes possible for functions to call themselves
as they are being defined in local bindings.

Change-Id: Ib46a39ba17b1452b5673d96fa729d633d237241a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6314
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-09-06 07:29:25 +00:00

4 lines
123 B
Nix

let
# self-recursive function should be able to close over itself
f = n: if n <= 0 then "done" else f (n - 1);
in f 10