110110
111111Examples:
112112
113- ```
113+ ``` python
114114user.Age in 18 ..45 and user.Name not in [" admin" , " root" ]
115115```
116116
117- ```
117+ ``` python
118118foo matches " ^[A-Z].*"
119119```
120120
@@ -127,7 +127,7 @@ the last element.
127127
128128The ` in ` operator can be used to check if an item is in an array or a map.
129129
130- ```
130+ ``` python
131131user.Name in list[" available-names" ]
132132```
133133
@@ -137,18 +137,17 @@ The `?.` operator can be used to access a field of a struct or an item of a map
137137without checking if the struct or the map is ` nil ` . If the struct or the map is
138138` nil ` , the result of the expression is ` nil ` .
139139
140- ```
140+ ``` python
141141author? .User? .Name
142142```
143143
144-
145144### Slice Operator
146145
147146The slice operator ` [:] ` can be used to access a slice of an array.
148147
149148For example, variable ` array ` is ` [1, 2, 3, 4, 5] ` :
150149
151- ```
150+ ``` python
152151array[1 :4 ] == [2 , 3 , 4 ]
153152array[1 :- 1 ] == [2 , 3 , 4 ]
154153array[:3 ] == [1 , 2 , 3 ]
@@ -164,7 +163,7 @@ array[:] == array
164163 <td>
165164 <a href="#allarray-predicate">all()</a><br>
166165 <a href="#anyarray-predicate">any()</a><br>
167- <a href="#lenarray -predicate">one()</a><br>
166+ <a href="#onearray -predicate">one()</a><br>
168167 <a href="#nonearray-predicate">none()</a><br>
169168 </td>
170169 <td>
@@ -186,7 +185,7 @@ array[:] == array
186185Returns ** true** if all elements satisfies the [ predicate] ( #predicate ) .
187186If the array is empty, returns ** true** .
188187
189- ```
188+ ``` python
190189all (Tweets, {.Size < 280 })
191190```
192191
@@ -200,7 +199,7 @@ If the array is empty, returns **false**.
200199Returns ** true** if _ exactly one_ element satisfies the [ predicate] ( #predicate ) .
201200If the array is empty, returns ** false** .
202201
203- ```
202+ ``` python
204203one(Participants, {.Winner})
205204```
206205
@@ -223,7 +222,7 @@ Returns new array by filtering elements of the array by [predicate](#predicate).
223222Returns the number of elements what satisfies the [ predicate] ( #predicate ) .
224223Equivalent to:
225224
226- ```
225+ ``` python
227226len (filter (array, predicate))
228227```
229228
@@ -239,7 +238,7 @@ Returns the absolute value of a number.
239238
240239Returns the integer value of a number or a string.
241240
242- ```
241+ ``` python
243242int (" 123" ) == 123
244243```
245244
@@ -252,19 +251,19 @@ Returns the float value of a number or a string.
252251The predicate is an expression that accepts a single argument. To access
253252the argument use the ` # ` symbol.
254253
255- ```
254+ ``` python
256255map (0 ..9 , {# / 2})
257256```
258257
259258If items of the array is a struct or a map , it is possible to access fields with
260259omitted `# ` symbol (`#.Value` becomes `.Value`).
261260
262- ```
261+ ```python
263262filter (Tweets, {len (.Value) > 280 })
264263```
265264
266265Braces `{}` can be omitted:
267266
268- ```
267+ ```python
269268filter (Tweets, len (.Value) > 280 )
270269```
0 commit comments