lib.concatMap and lib.mapAttrs to be builtins
This commit is contained in:
parent
1999d279ec
commit
e9a6c7cebb
@ -195,8 +195,9 @@ rec {
|
|||||||
{ x = "foo"; y = "bar"; }
|
{ x = "foo"; y = "bar"; }
|
||||||
=> { x = "x-foo"; y = "y-bar"; }
|
=> { x = "x-foo"; y = "y-bar"; }
|
||||||
*/
|
*/
|
||||||
mapAttrs = f: set:
|
mapAttrs = builtins.mapAttrs or
|
||||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set));
|
(f: set:
|
||||||
|
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)));
|
||||||
|
|
||||||
|
|
||||||
/* Like `mapAttrs', but allows the name of each attribute to be
|
/* Like `mapAttrs', but allows the name of each attribute to be
|
||||||
|
@ -101,7 +101,7 @@ rec {
|
|||||||
concatMap (x: [x] ++ ["z"]) ["a" "b"]
|
concatMap (x: [x] ++ ["z"]) ["a" "b"]
|
||||||
=> [ "a" "z" "b" "z" ]
|
=> [ "a" "z" "b" "z" ]
|
||||||
*/
|
*/
|
||||||
concatMap = f: list: concatLists (map f list);
|
concatMap = builtins.concatMap or (f: list: concatLists (map f list));
|
||||||
|
|
||||||
/* Flatten the argument into a single list; that is, nested lists are
|
/* Flatten the argument into a single list; that is, nested lists are
|
||||||
spliced into the top-level lists.
|
spliced into the top-level lists.
|
||||||
|
Loading…
Reference in New Issue
Block a user