on 8564483 help sign in
98 lines 1.4 kB history raw
1---
2navhome: /docs
3---
6# 4d: parsing (tracing)
7### `++last`
9Farther trace
11Compares two line-column pairs, called `++hair`s, `zyc` and `naz`, producing whichever
12is further along.
14Accepts
15-------
17`naz` is a hair.
19`zyc` is a hair.
21Produces
22--------
24a `++hair`.
26Source
27------
29 ++ last |= {zyc/hair naz/hair} :: farther trace
30 ^- hair
31 ?: =(p.zyc p.naz)
32 ?:((gth q.zyc q.naz) zyc naz)
33 ?:((gth p.zyc p.naz) zyc naz)
36Examples
37--------
39 > (last [1 1] [1 2])
40 [p=1 q=2]
41 > (last [2 1] [1 2])
42 [p=2 q=1]
43 > (last [0 0] [99 0])
44 [p=99 q=0]
45 > (last [7 7] [7 7])
46 [p=7 q=7]
49***
51### `++lust`
53Detect newline
55Advances the `++hair` `naz` by a row if the `++char` `weq` is a newline, or by a
56column if `weq` is any other character.
58Accepts
59-------
61`weq` is a char.
63`naz` is a hair.
65Produces
66--------
68A hair.
70Source
71------
73 ++ lust |= {weq/char naz/hair} :: detect newline
74 ^- hair
75 ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
79Examples
80--------
82 > (lust `a` [1 1])
83 [p=1 q=2]
84 > (lust `@t`10 [1 1])
85 [p=2 q=1]
86 > (lust '9' [10 10])
87 [p=10 q=11]
88 /> (roll "maze" [.(+<+ [1 1])]:lust)
89 [1 5]
90 /> %- roll :_ [.(+<+ [1 1])]:lust
91 """
92 Sam
93 lokes
94 """
95 [2 6]
98***