with
with, keyword
Introduces a block for constructs like table comprehensions, function bodies, and tile inputs.
Example (table comprehension)
table T = with
[| as Id, as X |]
[| "a", 3 |]
[| "b", 1 |]
[| "c", 4 |]
show table "T" with
T.Id
T.X
This outputs the following table:
| Id | X |
|---|---|
| a | 3 |
| b | 1 |
| c | 4 |
Example (function body)
def pure add(a: number, b: number) with
return a + b
show scalar "Sum" with add(3, 2)
This outputs the following scalar:
| Label | Value |
|---|---|
| Sum | 5 |
Example (scoped expression)
x = with
a = 1
return a + 1
show scalar "x" with x
This outputs the following scalar:
| Label | Value |
|---|---|
| x | 2 |
Remarks
with is also used in read, write, schema, and show blocks.