add genAttrs to nt.std
This commit is contained in:
parent
14f30ce5d7
commit
976ab6b80f
1 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
hasAttr
|
hasAttr
|
||||||
head
|
head
|
||||||
length
|
length
|
||||||
|
listToAttrs
|
||||||
mapAttrs
|
mapAttrs
|
||||||
partition
|
partition
|
||||||
removeAttrs
|
removeAttrs
|
||||||
|
|
@ -41,6 +42,11 @@ in rec {
|
||||||
|
|
||||||
getAttrDefault = name: default: getAttrOr name (_: default);
|
getAttrDefault = name: default: getAttrOr name (_: default);
|
||||||
|
|
||||||
|
genAttrs = names: f:
|
||||||
|
names
|
||||||
|
|> map (n: nameValuePair n (f n))
|
||||||
|
|> listToAttrs;
|
||||||
|
|
||||||
mergeAttrsList = list: let
|
mergeAttrsList = list: let
|
||||||
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
||||||
# Type: Int -> Int -> Attrs
|
# Type: Int -> Int -> Attrs
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue