aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/language/operators.md
blob: aeb77b72aa9d2b4168c9a416062f37c2ff0ff4d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Operators

## Select

> *e* `.` *attrpath* \[ `or` *def* \]

Select attribute denoted by the attribute path *attrpath* from set *e*. (An attribute path is a dot-separated list of attribute names.) If the attribute doesn’t exist, return *def* if provided, otherwise abort evaluation.

Associativity: none

Precedence: 1

## Application

> *e1* *e2*

Call function *e1* with argument *e2*.

Associativity: left

Precedence: 2

## Arithmetic Negation

> `-` *e*

Arithmetic negation.

Associativity: none

Precedence: 3

## Has Attribute

> *e* `?` *attrpath*

Test whether set *e* contains the attribute denoted by *attrpath*; return `true` or `false`.

Associativity: none

Precedence: 4

## List Concatenation

> *e1* `++` *e2*

List concatenation.

Associativity: right

Precedence: 5

## Multiplication

> *e1* `*` *e2*,

Arithmetic multiplication.

Associativity: left

Precedence: 6

## Division

> *e1* `/` *e2*

Arithmetic division.

Associativity: left

Precedence: 6

## Addition

> *e1* `+` *e2*

Arithmetic addition.

Associativity: left

Precedence: 7

## Subtraction

> *e1* `-` *e2*

Arithmetic subtraction.

Associativity: left

Precedence: 7

## String Concatenation

> *string1* `+` *string2*

String concatenation.

Associativity: left

Precedence: 7

## Not

> `!` *e*

Boolean negation.

Associativity: none

Precedence: 8

## Update

> *e1* `//` *e2*

Return a set consisting of the attributes in *e1* and *e2* (with the latter taking precedence over the former in case of equally named attributes).

Associativity: right

Precedence: 9

## Less Than

> *e1* `<` *e2*,

Arithmetic/lexicographic comparison.

Associativity: none

Precedence: 10

## Less Than or Equal To

> *e1* `<=` *e2*

Arithmetic/lexicographic comparison.

Associativity: none

Precedence: 10

## Greater Than

> *e1* `>` *e2*

Arithmetic/lexicographic comparison.

Associativity: none

Precedence: 10

## Greater Than or Equal To

> *e1* `>=` *e2*

Arithmetic/lexicographic comparison.

Associativity: none

Precedence: 10

## Equality

> *e1* `==` *e2*

Equality.

Associativity: none

Precedence: 11

## Inequality

> *e1* `!=` *e2*

Inequality.

Associativity: none

Precedence: 11

## Logical AND

> *e1* `&&` *e2*

Logical AND.

Associativity: left

Precedence: 12

## Logical OR

> *e1* <code>&#124;&#124;</code> *e2*

Logical OR.

Associativity: left

Precedence: 13

## Logical Implication

> *e1* `->` *e2*

Logical implication (equivalent to <code>!e1 &#124;&#124; e2</code>).

Associativity: none

Precedence: 14