# Predicate taking an attribute name and an attribute value, which returns `true` to include the attribute, or `false` to exclude the attribute.
pred:
# The attribute set to filter
set:
listToAttrs(
concatMap(name:
@@ -709,8 +690,8 @@ rec {
The result of the callback function is often called `acc` for accumulator. It is passed between callbacks from left to right and the final `acc` is the return value of `foldlAttrs`.
Attention:
There is a completely different function
`lib.foldAttrs`
There is a completely different function `lib.foldAttrs`
which has nothing to do with this function, despite the similar name.
@@ -824,11 +805,8 @@ rec {
:::
*/
foldAttrs=
# A function, given a value and a collector combines the two.
op:
# The starting value.
nul:
# A list of attribute sets to fold together by key.
list_of_attrs:
foldr(n:a:
foldr(name:o:
@@ -875,9 +853,7 @@ rec {
:::
*/
collect=
# Given an attribute's value, determine if recursion should stop.
pred:
# The attribute set to recursively collect.
attrs:
ifpredattrsthen
[attrs]
@@ -919,7 +895,6 @@ rec {
:::
*/
cartesianProductOfSets=
# Attribute set with attributes that are lists of values
attrsOfLists:
foldl'(listOfAttrs:attrName:
concatMap(attrs:
@@ -960,9 +935,7 @@ rec {
:::
*/
nameValuePair=
# Attribute name
name:
# Attribute value
value:
{inheritnamevalue;};
@@ -1026,9 +999,7 @@ rec {
:::
*/
mapAttrs'=
# A function, given an attribute's name and value, returns a new `nameValuePair`.
Call a function for each attribute in the given set and return
the result in a list.
# Inputs
`f`
@@ -1067,9 +1037,7 @@ rec {
:::
*/
mapAttrsToList=
# A function, given an attribute's name and value, returns a new value.
f:
# Attribute set to map over.
attrs:
map(name:fnameattrs.${name})(attrNamesattrs);
@@ -1139,9 +1107,7 @@ rec {
```
*/
mapAttrsRecursive=
# A function that, given an attribute path as a list of strings and the corresponding attribute value, returns a new value.
f:
# Attribute set to recursively map over.
set:
mapAttrsRecursiveCond(as:true)fset;
@@ -1170,12 +1136,8 @@ rec {
```
*/
mapAttrsRecursiveCond=
# A function that, given the attribute set the recursion is currently at, determines if to recurse deeper into that attribute set.
cond:
# A function that, given an attribute path as a list of strings and the corresponding attribute value, returns a new value.
# The attribute value is either an attribute set for which `cond` returns false, or something other than an attribute set.
f:
# Attribute set to recursively map over.
set:
let
recurse=path:
@@ -1221,9 +1183,7 @@ rec {
:::
*/
genAttrs=
# Names of values in the resulting attribute set.
names:
# A function, given the name of the attribute, returns the attribute's value.
f:
listToAttrs(map(n:nameValuePairn(fn))names);
@@ -1260,7 +1220,6 @@ rec {
:::
*/
isDerivation=
# Value to check.
value:value.typeornull=="derivation";
/**
@@ -1280,7 +1239,6 @@ rec {
```
*/
toDerivation=
# A store path to convert to a derivation.
path:
let
path'=builtins.storePathpath;
@@ -1330,9 +1288,7 @@ rec {
:::
*/
optionalAttrs=
# Condition under which the `as` attribute set is returned.
cond:
# The attribute set to return if `cond` is `true`.
as:
ifcondthenaselse{};
@@ -1374,11 +1330,8 @@ rec {
:::
*/
zipAttrsWithNames=
# List of attribute names to zip.
names:
# A function, accepts an attribute name, all the values, and returns a combined value.
f:
# List of values from the list of attribute sets.
sets:
listToAttrs(map(name:{
inheritname;
@@ -1551,11 +1504,8 @@ rec {
:::
*/
recursiveUpdateUntil=
# Predicate, taking the path to the current attribute as a list of strings for attribute names, and the two values at that path from the original arguments.