diff options
Diffstat (limited to 'doc/manual/expressions')
-rw-r--r-- | doc/manual/expressions/builtins.xml | 11 | ||||
-rw-r--r-- | doc/manual/expressions/derivations.xml | 2 | ||||
-rw-r--r-- | doc/manual/expressions/language-constructs.xml | 18 | ||||
-rw-r--r-- | doc/manual/expressions/language-values.xml | 17 |
4 files changed, 27 insertions, 21 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index eae5f5a029bf..6ac802343236 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -142,7 +142,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else ""</programlisting> evaluates to the Nix platform identifier for the Nix installation on which the expression is being evaluated, such as <literal>"i686-linux"</literal> or - <literal>"powerpc-darwin"</literal>.</para></listitem> + <literal>"x86_64-darwin"</literal>.</para></listitem> </varlistentry> @@ -853,7 +853,14 @@ builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ] len</replaceable> lies beyond the end of the string, only the substring up to the end of the string is returned. <replaceable>start</replaceable> must be - non-negative.</para></listitem> + non-negative. For example, + +<programlisting> +builtins.substring 0 3 "nixos" +</programlisting> + + evaluates to <literal>"nix"</literal>. + </para></listitem> </varlistentry> diff --git a/doc/manual/expressions/derivations.xml b/doc/manual/expressions/derivations.xml index f2a73dccfe18..5efe2213e370 100644 --- a/doc/manual/expressions/derivations.xml +++ b/doc/manual/expressions/derivations.xml @@ -16,7 +16,7 @@ of which specify the inputs of the build.</para> <listitem xml:id="attr-system"><para>There must be an attribute named <varname>system</varname> whose value must be a string specifying a Nix platform identifier, such as <literal>"i686-linux"</literal> or - <literal>"powerpc-darwin"</literal><footnote><para>To figure out + <literal>"x86_64-darwin"</literal><footnote><para>To figure out your platform identifier, look at the line <quote>Checking for the canonical Nix system name</quote> in the output of Nix's <filename>configure</filename> script.</para></footnote> The build diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index 7535e64ea9a5..fe69dba837a1 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -202,24 +202,6 @@ in concat { x = "foo"; y = "bar"; }</programlisting> </para> -<para>A set that has a <literal>__functor</literal> attribute whose value -is callable (i.e. is itself a function or a set with a -<literal>__functor</literal> attribute whose value is callable) can be -applied as if it were a function, with the set itself passed in first -, e.g., - -<programlisting> -let add = { __functor = self: x: x + self.x; }; - inc = add // { x = 1; }; -in inc 1 -</programlisting> - -evaluates to <literal>2</literal>. This can be used to attach metadata to a -function without the caller needing to treat it specially, or to implement -a form of object-oriented programming, for example. - -</para> - </simplesect> diff --git a/doc/manual/expressions/language-values.xml b/doc/manual/expressions/language-values.xml index f1174ecb5d8d..b90baac5054c 100644 --- a/doc/manual/expressions/language-values.xml +++ b/doc/manual/expressions/language-values.xml @@ -276,6 +276,23 @@ added to the set: This will evaluate to <literal>{}</literal> if <literal>foo</literal> evaluates to <literal>false</literal>.</para> +<para>A set that has a <literal>__functor</literal> attribute whose value +is callable (i.e. is itself a function or a set with a +<literal>__functor</literal> attribute whose value is callable) can be +applied as if it were a function, with the set itself passed in first +, e.g., + +<programlisting> +let add = { __functor = self: x: x + self.x; }; + inc = add // { x = 1; }; +in inc 1 +</programlisting> + +evaluates to <literal>2</literal>. This can be used to attach metadata to a +function without the caller needing to treat it specially, or to implement +a form of object-oriented programming, for example. + +</para> </simplesect> |