Debian Codegraph @

doc/presentations/bts2022/jq3

raw
1 # Generators and backtracking
2 > 1, (2, 3 | . * 2), 4
3 1
4 4
5 6
6 4
7
8 # Conditional, boolean operators and comparison
9 > if 1 == 2 and true then "a" else "b" end
10 "b"
11
12 # Reduce and foreach
13 > reduce (1,2,3) as $i (0; . + $i)
14 6
15 > foreach (1,2,3) as $i (0; . + $i; .)
16 1
17 3
18 6
19
20 # Bindings (variables)
21 > 1 as $a | 2 as $b | $a + $b
22 3