added mergeAttr and concatList functions giving // and ++ a name
svn path=/nixpkgs/trunk/; revision=13542
This commit is contained in:
parent
1f69d4d1eb
commit
bd0b75fe28
@ -81,8 +81,8 @@ rec {
|
|||||||
|
|
||||||
|
|
||||||
# Concatenate a list of lists.
|
# Concatenate a list of lists.
|
||||||
concatLists =
|
concatList = x : y : x ++ y;
|
||||||
fold (x: y: x ++ y) [];
|
concatLists = fold concatList [];
|
||||||
|
|
||||||
|
|
||||||
# Concatenate a list of strings.
|
# Concatenate a list of strings.
|
||||||
@ -636,7 +636,8 @@ rec {
|
|||||||
# iterates over a list of attributes collecting the attribute attr if it exists
|
# iterates over a list of attributes collecting the attribute attr if it exists
|
||||||
catAttrs = attr : l : fold ( s : l : if (hasAttr attr s) then [(builtins.getAttr attr s)] ++ l else l) [] l;
|
catAttrs = attr : l : fold ( s : l : if (hasAttr attr s) then [(builtins.getAttr attr s)] ++ l else l) [] l;
|
||||||
|
|
||||||
mergeAttrs = fold ( x : y : x // y) {};
|
mergeAttr = x : y : x // y;
|
||||||
|
mergeAttrs = fold mergeAttr {};
|
||||||
|
|
||||||
attrVals = nameList : attrSet :
|
attrVals = nameList : attrSet :
|
||||||
map (x: builtins.getAttr x attrSet) nameList;
|
map (x: builtins.getAttr x attrSet) nameList;
|
||||||
|
Loading…
Reference in New Issue
Block a user