diff options
author | sterni <sternenseemann@systemli.org> | 2022-10-23T21·03+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-10-23T21·08+0000 |
commit | dfa4c4847c2c597300a5ee4fa80a209d2a6453e0 (patch) | |
tree | df156d0df0e7d372e4ddf86ebdfc1261313c2cd9 /users/sterni/nix/fun | |
parent | 89aee6443c0211759480911f3e4f9a7ce9eb2423 (diff) |
refactor(sterni/nix/fun): key can also be an int r/5188
Change-Id: Ia27be70ef07d9aa7d13821a2808ded9cf16506c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7073 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'users/sterni/nix/fun')
-rw-r--r-- | users/sterni/nix/fun/default.nix | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/users/sterni/nix/fun/default.nix b/users/sterni/nix/fun/default.nix index bb10f9e6c1bf..824cebfed244 100644 --- a/users/sterni/nix/fun/default.nix +++ b/users/sterni/nix/fun/default.nix @@ -192,20 +192,18 @@ let # and the list of arguments to pass to be found in args. startSet = [ { - key = "0"; - id = 0; + key = 0; final = false; inherit args; } ]; operator = - { id, final, ... }@state: + { key, final, ... }@state: let # Plumbing to make genericClosure happy - newIds = { - key = toString (id + 1); - id = id + 1; + newId = { + key = key + 1; }; # Perform recursion step @@ -215,10 +213,10 @@ let # otherwise signal that we're done. newState = if builtins.isAttrs call && call.__tailCall or false - then newIds // { + then newId // { final = false; inherit (call) args; - } else newIds // { + } else newId // { final = true; value = call; }; |