forked from DGNum/infrastructure
feat(lib): init genFuse
This commit is contained in:
parent
85374e9d6c
commit
ecb6b54b9e
1 changed files with 18 additions and 0 deletions
|
@ -49,6 +49,24 @@ rec {
|
|||
attrsList:
|
||||
fuseAttrs (builtins.map f attrsList);
|
||||
|
||||
/*
|
||||
Generate an `attrsList` of given size with the generator before fusing
|
||||
the resulting list of attribute sets.
|
||||
|
||||
Type: (Int -> attrs) -> Int -> attrs
|
||||
|
||||
Example:
|
||||
f = s: { "a${toString s}" = s + s; }
|
||||
genFuse f 3
|
||||
=> { a0 = 0; a1 = 2; a2 = 4; }
|
||||
*/
|
||||
genFuse =
|
||||
# Int -> attrs
|
||||
f:
|
||||
# Int
|
||||
size:
|
||||
fuseAttrs (builtins.genList f size);
|
||||
|
||||
/*
|
||||
Equivalent of lib.singleton but for an attribute set.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue