From 7da59e94ae6d5123acbca7bdbbef4d08b02fc709 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Fri, 23 Dec 2022 08:58:19 +0100 Subject: [PATCH] add links to documentation for data types --- doc/manual/src/language/operators.md | 56 ++++++++++++++++------------ 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/doc/manual/src/language/operators.md b/doc/manual/src/language/operators.md index 459ea9945..1f11e6ac5 100644 --- a/doc/manual/src/language/operators.md +++ b/doc/manual/src/language/operators.md @@ -4,7 +4,7 @@ > *attrset* `.` *attrpath* \[ `or` *value* \] -Select the attribute denoted by attribute path *attrpath* from attribute set *attrset*. +Select the attribute denoted by attribute path *attrpath* from [attribute set] *attrset*. An attribute path is a dot-separated list of attribute names. If the attribute doesn’t exist, return *value* if provided, otherwise abort evaluation. @@ -16,7 +16,7 @@ Precedence: 1 > *f* *a* -Call function *f* with argument *a*. +Call [function] *f* with argument *a*. Associativity: left @@ -26,7 +26,7 @@ Precedence: 2 > `-` *n* -Flip the sign of the number *n*. +Flip the sign of the [number] *n*. Associativity: none @@ -36,7 +36,7 @@ Precedence: 3 > *attrset* `?` *attrpath* -Test whether attribute set *attrset* contains the attribute denoted by *attrpath*; return `true` or `false`. +Test whether [attribute set] *attrset* contains the attribute denoted by *attrpath*; return `true` or `false`. Associativity: none @@ -46,7 +46,7 @@ Precedence: 4 > *list1* `++` *list2* -Concatenate lists *list1* and *list2*. +Concatenate [list]s *list1* and *list2*. Associativity: right @@ -56,7 +56,7 @@ Precedence: 5 > *n1* `*` *n2*, -Multiply numbers *n1* and *n2*. +Multiply [number]s *n1* and *n2*. Associativity: left @@ -66,7 +66,7 @@ Precedence: 6 > *n1* `/` *n2* -Divide numbers *n1* and *n2*. +Divide [number]s *n1* and *n2*. Associativity: left @@ -76,7 +76,7 @@ Precedence: 6 > *n1* `-` *n2* -Subtract numbers *n2* from *n1*. +Subtract [number] *n2* from *n1*. Associativity: left @@ -86,7 +86,7 @@ Precedence: 7 > *n1* `+` *n2* -Add numbers *n1* and *n2*. +Add [number]s *n1* and *n2*. Associativity: left @@ -96,7 +96,7 @@ Precedence: 7 > *string1* `+` *string2* -Concatenate *string1* and *string1* and merge their string contexts. +Concatenate two [string]s and merge their string contexts. Associativity: left @@ -106,19 +106,19 @@ Precedence: 7 > *path1* `+` *path2* -Concatenate two paths. +Concatenate two [path]s. The result is a path. ## Path and string concatenation > *path* `+` *string* -Concatenate *path* with *string*. +Concatenate *[path]* with *[string]*. The result is a path. > **Note** > -> The string must not have a string context that refers to a store path. +> The string must not have a string context that refers to a [store path]. Associativity: left @@ -128,13 +128,13 @@ Precedence: 7 > *string* `+` *path* -Concatenate *string* with *path*. +Concatenate *[string]* with *[path]*. The result is a string. > **Important** > -> The file or directory at *path* must exist and is copied to the store -> The path appears in the result as the corresponding store path. +> The file or directory at *path* must exist and is copied to the [store]. +> The path appears in the result as the corresponding [store path]. Associativity: left @@ -144,7 +144,7 @@ Precedence: 7 > `!` *b* -Negate the Boolean value *b*. +Negate the [Boolean] value *b*. Associativity: none @@ -154,7 +154,7 @@ Precedence: 8 > *attrset1* `//` *attrset1* -Update attribute set *attrset1* with names and values from *attrset2*. +Update [attribute set] *attrset1* with names and values from *attrset2*. The returned attribute set will have of all the attributes in *e1* and *e2*. If an attribute name is present in both, the attribute value from the former is taken. @@ -165,9 +165,9 @@ Precedence: 9 ## Comparison -- Arithmetic comparison for numbers -- Lexicographic comparison for strings and paths -- Lexicographic comparison for lists: +- Arithmetic comparison for [number]s +- Lexicographic comparison for [string]s and [path]s +- Lexicographic comparison for [list]s: Elements at the same index in both lists are compared according to their type and skipped if they are equal. Associativity: none @@ -196,8 +196,8 @@ Precedence: 10 Check expressions *e1* and *e2* for value equality. -- Attribute sets and lists are compared recursively, and therefore are fully evaluated. -- Comparison of functions always returns `false`. +- [Attribute sets][attribute set] and [list]s are compared recursively, and therefore are fully evaluated. +- Comparison of [function]s always returns `false`. - Integers are coerced to floating point numbers if compared to floating point numbers. - Floating point numbers only differ up to a limited precision. @@ -246,3 +246,13 @@ Equivalent to `!`*b1* `||` *b2*. Associativity: none Precedence: 14 + +[string]: ./values.md#type-string +[path]: ./values.md#type-path +[number]: ./values.md#type-number +[Boolean]: ./values.md#type-boolean +[list]: ./values.md#list +[attribute set]: ./values.md#attribute-set +[function]: ./constructs.md#functions +[store path]: ../glossary.md#gloss-store-path +[store]: ../glossary.md#gloss-store