forked from lix-project/lix
manual: document builtins.functionArgs
The text is just a conversion of comment from src/libexpr/primops.cc
This commit is contained in:
parent
5eb93556f1
commit
29c0199d5c
|
@ -335,7 +335,7 @@ stdenv.mkDerivation {
|
|||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><function>builtins.foldl’</function>
|
||||
<varlistentry><term><function>builtins.foldl’</function>
|
||||
<replaceable>op</replaceable> <replaceable>nul</replaceable> <replaceable>list</replaceable></term>
|
||||
|
||||
<listitem><para>Reduce a list by applying a binary operator, from
|
||||
|
@ -348,6 +348,24 @@ stdenv.mkDerivation {
|
|||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><function>builtins.functionArgs</function>
|
||||
<replaceable>f</replaceable></term>
|
||||
|
||||
<listitem><para>
|
||||
Return a set containing the names of the formal arguments expected
|
||||
by the function <replaceable>f</replaceable>.
|
||||
The value of each attribute is a Boolean denoting whether the corresponding
|
||||
argument has a default value. For instance,
|
||||
<literal>functionArgs ({ x, y ? 123}: ...) = { x = false; y = true; }</literal>.
|
||||
</para>
|
||||
|
||||
<para>"Formal argument" here refers to the attributes pattern-matched by
|
||||
the function. Plain lambdas are not included, e.g.
|
||||
<literal>functionArgs (x: ...) = { }</literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><function>builtins.fromJSON</function> <replaceable>e</replaceable></term>
|
||||
|
||||
<listitem><para>Convert a JSON string to a Nix
|
||||
|
|
|
@ -1154,7 +1154,7 @@ static void prim_catAttrs(EvalState & state, const Pos & pos, Value * * args, Va
|
|||
|
||||
/* Return a set containing the names of the formal arguments expected
|
||||
by the function `f'. The value of each attribute is a Boolean
|
||||
denoting whether has a default value. For instance,
|
||||
denoting whether the corresponding argument has a default value. For instance,
|
||||
|
||||
functionArgs ({ x, y ? 123}: ...)
|
||||
=> { x = false; y = true; }
|
||||
|
|
Loading…
Reference in a new issue