on 91ef98f help sign in
99 lines 1.3 kB history raw
1+++
2title = "4d: Parsing (Tracing)"
3weight = 31
4template = "doc.html"
5+++
6### `++last`
8Further trace
10Compares two line-column pairs, `zyc` and `naz`, producing
11whichever is further along.
13#### Accepts
15`naz` is a `hair`.
17`zyc` is a `hair`.
19#### Produces
21A `hair`.
23#### Source
25```
26 ++ last |= [zyc=hair naz=hair]
27 ^- hair
28 ?: =(p.zyc p.naz)
29 ?:((gth q.zyc q.naz) zyc naz)
30 ?:((gth p.zyc p.naz) zyc naz)
31```
33#### Examples
35```
36 > (last [1 1] [1 2])
37 [p=1 q=2]
39 > (last [2 1] [1 2])
40 [p=2 q=1]
42 > (last [0 0] [99 0])
43 [p=99 q=0]
45 > (last [7 7] [7 7])
46 [p=7 q=7]
47```
49---
50### `++lust`
52Detect newline
54Advances `naz` by a row if the `weq` is a newline, or by a column if `weq` is
55any other character.
57#### Accepts
59`weq` is a `char`.
61`naz` is a `hair`.
63#### Produces
65A hair.
67#### Source
69```
70 ++ lust |= [weq=char naz=hair]
71 ^- hair
72 ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
73```
76#### Examples
78```
79 > (lust `a` [1 1])
80 [p=1 q=2]
82 > (lust `@t`10 [1 1])
83 [p=2 q=1]
85 > (lust '9' [10 10])
86 [p=10 q=11]
88 > (roll "maze" [.(+<+ [1 1])]:lust)
89 [1 5]
91 > %- roll :_ [.(+<+ [1 1])]:lust
92 """
93 Sam
94 lokes
95 """
96 [2 6]
97```
99---