on 492ae2f help sign in
36 lines 965 B history raw
1# `:per`, `=>`, "tisgar" `{$per p/twig q/twig}`
3`p` as subject of `q`.
5Uses the product of `p` as the subject of formula `q`. For code readability,
6use `=>` when your `p` isn't as long as `q`, and `=<` when `q` is longer than
7`p`.
9Regular form: *2-fixed*
11Examples:
13 ~zod/try=> =>([a=1 b=2 c=3] b)
14 2
15 ~zod/try=> =>((add 2 4) [. .])
16 [6 6]
18In this simple example we first produce `b` from the tuple
19`[a=1 b=2 c=3]` using the wide form of `=>`. Then we use `.` to produce
20our context from the computation `(add 2 4)` as a cell, `[6 6]`.
22 ~zod/try=>
23 =cor |= a=@
24 =+ b=0
25 => .(b (add 2 b))
26 => .(a (add a b))
27 [a b]
28 new var %cor
29 /~zod/try=>
30 (cor 4)
31 [6 2]
33Here we see a common pattern for using `=>` to conduct procedural
34changes to values in our subject. First we replace `b` with `b+2` using
35the irregular form of `%-`, then we replace `a` with the sum of `a` and
36`b` the same way.