From 1a7e88bbd9290987e72616d42c9e9d344acc2a86 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 12 Dec 2006 16:14:31 +0000 Subject: * New built-in function `builtins.attrNames' that returns the names of the attributes in an attribute set. --- doc/manual/writing-nix-expressions.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/manual/writing-nix-expressions.xml') diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 1cc5bb95b8c3..9770e91822b5 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -1362,6 +1362,24 @@ is also available as builtins.derivation. + builtins.attrNames + attrs + + Return the names of the attributes in the + attribute set attrs in a sorted list. + For instance, builtins.attrNames {y = 1; x = + "foo";} evaluates to ["x" "y"]. + There is no built-in function attrValues, but + you can easily define it yourself: + + +attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs); + + + + + + baseNameOf s Return the base name of the -- cgit 1.4.1