From 722bd041cecbaa016f3b82ba99aff140acae5442 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 29 Oct 2014 16:18:03 +0100 Subject: Document some primops --- doc/manual/expressions/builtins.xml | 64 ++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'doc/manual/expressions') diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 4edb3a1a76fb..3cdf4e28fe6a 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -45,14 +45,17 @@ available as builtins.derivation. Return the names of the attributes in the set set 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: + evaluates to [ "x" "y" ]. - -attrValues = set: map (name: builtins.getAttr name set) (builtins.attrNames set); + - + + builtins.attrValues + set + + Return the values of the attributes in the set + set in the order corresponding to the + sorted attribute names. @@ -144,6 +147,19 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" --> + builtins.deepSeq + e1 e2 + + This is like seq + e1 + e2, except that + e1 is evaluated + deeply: if it’s a list or set, its elements + or attributes are also evaluated recursively. + + + + derivation attrs @@ -596,13 +612,26 @@ in config.someSetting - builtins.readFile @@ -622,14 +651,25 @@ in config.someSetting set. The attributes don’t have to exist in set. For instance, - -removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] + +removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] evaluates to { y = 2; }. + builtins.seq + e1 e2 + + Evaluate e1, then + evaluate and return e2. This ensures + that a computation is strict in the value of + e1. + + + + builtins.stringLength e -- cgit 1.4.1