| 1 | <h2>Comments</h2> |
| 2 | <pre><code># Single line comment |
| 3 | ### Module level documentation comment |
| 4 | ## Statement level documentation comment |
| 5 | # Regular code comment |
| 6 | </code></pre> |
| 7 | |
| 8 | <h2>Strings</h2> |
| 9 | <pre><code> |
| 10 | # double quote single line strings |
| 11 | "foo \"bar\" baz" |
| 12 | |
| 13 | # heredocs or multiline strings |
| 14 | """ |
| 15 | { "snot": "badger" } |
| 16 | """ |
| 17 | </code></pre> |
| 18 | |
| 19 | <h2>Variables</h2> |
| 20 | <pre><code> |
| 21 | # Immutable constants |
| 22 | const snot = "fleek"; |
| 23 | |
| 24 | # Mutable variables |
| 25 | let badger = "flook"; |
| 26 | </code></pre> |
| 27 | |
| 28 | <h2>Operators</h2> |
| 29 | <pre><code> |
| 30 | merge {} of |
| 31 | { "snot": "badger" } |
| 32 | end; |
| 33 | |
| 34 | patch {} of |
| 35 | insert snot = "badger" |
| 36 | end; |
| 37 | </code></pre> |
| 38 | |
| 39 | <h2>Functions and keywords</h2> |
| 40 | <pre><code> |
| 41 | fn fib_(a, b, n) of |
| 42 | case (a, b, n) when n > 0 => recur(b, a + b, n - 1) |
| 43 | default => a |
| 44 | end; |
| 45 | |
| 46 | fn fib(n) with |
| 47 | fib_(0, 1, n) |
| 48 | end; |
| 49 | |
| 50 | fib(event) |
| 51 | </code></pre> |
| 52 | |
| 53 | <h2>Queries</h2> |
| 54 | <pre><code> |
| 55 | define script fib |
| 56 | script |
| 57 | fn fib_(a, b, n) of |
| 58 | case (a, b, n) when n > 0 => recur(b, a + b, n - 1) |
| 59 | default => a |
| 60 | end; |
| 61 | |
| 62 | fn fib(n) with |
| 63 | fib_(0, 1, n) |
| 64 | end; |
| 65 | |
| 66 | { "fib": fib(event.n) } |
| 67 | end; |
| 68 | |
| 69 | create script fib; |
| 70 | select event.n from in into fib; |
| 71 | select event from fib into out; |
| 72 | </code></pre> |
| 73 | |
| 74 | <h2>Deployments</h2> |
| 75 | <pre><code> |
| 76 | define pipeline passthrough |
| 77 | pipeline |
| 78 | select event from in into out; |
| 79 | end; |
| 80 | |
| 81 | deploy pipeline passthrough; |
| 82 | </code></pre> |