add genAttrs to nt.std

This commit is contained in:
Emile Clark-Boman 2026-01-27 17:48:51 +10:00
parent 14f30ce5d7
commit 976ab6b80f

View file

@ -8,6 +8,7 @@
hasAttr
head
length
listToAttrs
mapAttrs
partition
removeAttrs
@ -41,6 +42,11 @@ in rec {
getAttrDefault = name: default: getAttrOr name (_: default);
genAttrs = names: f:
names
|> map (n: nameValuePair n (f n))
|> listToAttrs;
mergeAttrsList = list: let
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
# Type: Int -> Int -> Attrs