You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slicing follows Python conventions: it is 0-indexed and works with negative indices. The `.slice()` calls always requires two arguments. If you need to slice until the end of the list, do `this.slice(pos, size(this.slice))`. Similarly, do `this.slice(0, pos)` to start from the beginning.
217
-
218
-
If you want to keep your CEL code portable, pass the `--no-extensions` arguments to disable slicing and all other extensions.
219
-
220
226
### Reading CEL from a file
221
227
222
228
In the previous example, the CEL expression for the JSON became long. Let's say we saved the expression in `stock.cel` with the following contents:
@@ -234,6 +240,19 @@ If we pass the `--from-file` argument, we can load the expression and keep the c
234
240
cat yfinance.json | celq --from-file stock.cel
235
241
```
236
242
243
+
### Slicing lists
244
+
245
+
`celq` implements the popular slice extension for CEL. For example:
Slicing follows Python conventions: it is 0-indexed and works with negative indices. The `.slice()` calls always requires two arguments. If you need to slice until the end of the list, do `this.slice(pos, size(this.slice))`. Similarly, do `this.slice(0, pos)` to start from the beginning.
253
+
254
+
If you want to keep your CEL code portable, pass the `--no-extensions` arguments to disable slicing and all other extensions.
255
+
237
256
### Dealing with NDJSON
238
257
239
258
`celq` can deal with [Newline-Delimited JSON (NDJSON)](https://web.archive.org/web/20231218162511/https://ndjson.org/). That format is also called [JSON Lines (JSONL)](https://web.archive.org/web/20251130123805/https://jsonlines.org./).
0 commit comments