groupBy
builtins.groupBy
Primop
Docs pulled from | This Revision | 13 minutes ago
Takes 2 arguments
f, list
Groups elements of list together by the string returned from the function f called on each element. It returns an attribute set where each attribute value contains the elements of list that are mapped to the same corresponding attribute name returned by f.
For example,
builtins.groupBy (builtins.substring 0 1) ["foo" "bar" "baz"]
evaluates to
{ b = [ "bar" "baz" ]; f = [ "foo" ]; }
This function is not defined in a .nix file. It is likely a builtins function or an alias of a builtins function. builtins functions are predefined functions provided by Nix.
Noogle detected
Detected Type
groupBy :: (a -> b) -> [a] -> AttrSet
Implementation
This function is implemented in c++ and is part of the native nix runtime.