on master help sign in
cleaned things up
7192258iko
desk/lib/interlist.hoon+1−6
@@ -1,11 +1,6 @@
1+/- *interlist
1=<
2=<
2|%
3|%
3−++ interlist
4− |$ [sep val]
5− $%
6− [%double =val =sep tail=(interlist sep val)]
7− [%single =val]
8− ==
9++ new
4++ new
10 |* [a=* b=(list [* *])]
5 |* [a=* b=(list [* *])]
11 ^- (interlist _?<(?=(~ b) -.i.b) _a)
6 ^- (interlist _?<(?=(~ b) -.i.b) _a)
desk/lib/lua.hoondeleted−2
@@ -1,2 +0,0 @@
1−|%
2−--
desk/lib/lua/parser.hoon+19−18
@@ -1,6 +1,7 @@
1/- *lua
1/- *lua
2+/- *interlist
2/+ st
3/+ st
3−/+ interlist
4+/+ inter=interlist
4=<
5=<
5apex
6apex
6|%
7|%
@@ -57,8 +58,8 @@ apex
57:: Parse expressions separated by binary operators
58:: Parse expressions separated by binary operators
58::
59::
59++ parse-expr-list
60++ parse-expr-list
60− %^ tnee %parse-expr-list ,(interlist:interlist binop [(list unop) expr])
61+ %^ tnee %parse-expr-list ,(interlist binop [(list unop) expr])
61− %+ parse:interlist (ifix [ws ws] parse-binop)
62+ %+ parse:inter (ifix [ws ws] parse-binop)
62 ;~ plug
63 ;~ plug
63 %- star
64 %- star
64 ;~ pose
65 ;~ pose
@@ -80,7 +81,7 @@ apex
80 ==
81 ==
81++ process-expr-list
82++ process-expr-list
82 =<
83 =<
83− |= l=(interlist:interlist binop [(list unop) expr])
84+ |= l=(interlist binop [(list unop) expr])
84 ^- expr
85 ^- expr
85 %- strip-tree
86 %- strip-tree
86 %- (process-right-assoc ~[%pow])
87 %- (process-right-assoc ~[%pow])
@@ -103,13 +104,13 @@ apex
103 [%branch b=unop t=working-tree]
104 [%branch b=unop t=working-tree]
104 [%tbd-unop l=(list [=expr =binop]) =unop r=working-tree]
105 [%tbd-unop l=(list [=expr =binop]) =unop r=working-tree]
105 [%unoped l=(list [=expr =binop]) r=working-tree]
106 [%unoped l=(list [=expr =binop]) r=working-tree]
106− [%leaf (interlist:interlist binop expr)]
107+ [%leaf (interlist binop expr)]
107 ==
108 ==
108 ++ preprocess-tree
109 ++ preprocess-tree
109− |= l=(interlist:interlist binop [(list unop) expr])
110+ |= l=(interlist binop [(list unop) expr])
110 ^- working-tree
111 ^- working-tree
111 =/ splitted (find-unop l)
112 =/ splitted (find-unop l)
112− ?~ splitted leaf+(turn:interlist l |=([* =expr] expr))
113+ ?~ splitted leaf+(turn:inter l |=([* =expr] expr))
113 tbd-unop+[l.u.splitted unop.u.splitted $(l r.u.splitted)]
114 tbd-unop+[l.u.splitted unop.u.splitted $(l r.u.splitted)]
114 ++ apply-unops
115 ++ apply-unops
115 |= [unops=(list unop) =expr]
116 |= [unops=(list unop) =expr]
@@ -127,8 +128,8 @@ apex
127 %unoped ?> =(~ l.tree) $(tree r.tree)
128 %unoped ?> =(~ l.tree) $(tree r.tree)
128 ==
129 ==
129 ++ find-unop
130 ++ find-unop
130− |= l=(interlist:interlist binop [(list unop) expr])
131+ |= l=(interlist binop [(list unop) expr])
131− ^- (unit [l=(list [=expr =binop]) =unop r=(interlist:interlist binop [(list unop) expr])])
132+ ^- (unit [l=(list [=expr =binop]) =unop r=(interlist binop [(list unop) expr])])
132 ?- -.l
133 ?- -.l
133 %single
134 %single
134 ?~ +<.l ~
135 ?~ +<.l ~
@@ -137,7 +138,7 @@ apex
137 %double
138 %double
138 ?~ -.val.l
139 ?~ -.val.l
139 %+ ^^bind $(l tail.l)
140 %+ ^^bind $(l tail.l)
140− |= [k=(list [expr binop]) =unop tail=(interlist:interlist binop [(list unop) expr])]
141+ |= [k=(list [expr binop]) =unop tail=(interlist binop [(list unop) expr])]
141 [[[+.val.l sep.l] k] unop tail]
142 [[[+.val.l sep.l] k] unop tail]
142 %- some
143 %- some
143 [~ i.-.val.l double+[[t.-.val.l +.val.l] sep.l tail.l]]
144 [~ i.-.val.l double+[[t.-.val.l +.val.l] sep.l tail.l]]
@@ -154,7 +155,7 @@ apex
154 ==
155 ==
155 ++ split-left-unop-list
156 ++ split-left-unop-list
156 |= [is-pivot=$-(binop ?) l=(list [=expr =binop])]
157 |= [is-pivot=$-(binop ?) l=(list [=expr =binop])]
157− ^- (unit [l=(interlist:interlist binop expr) =binop r=(list [=expr =binop])])
158+ ^- (unit [l=(interlist binop expr) =binop r=(list [=expr =binop])])
158 ?~ l ~
159 ?~ l ~
159 ?: (is-pivot binop.i.l) `[single+expr.i.l binop.i.l t.l]
160 ?: (is-pivot binop.i.l) `[single+expr.i.l binop.i.l t.l]
160 =/ rest $(l t.l)
161 =/ rest $(l t.l)
@@ -162,17 +163,17 @@ apex
162 `[double+[expr.i.l binop.i.l -.u.rest] +.u.rest]
163 `[double+[expr.i.l binop.i.l -.u.rest] +.u.rest]
163 ++ split-right-unop-list
164 ++ split-right-unop-list
164 |= [is-pivot=$-(binop ?) l=(list [=expr =binop])]
165 |= [is-pivot=$-(binop ?) l=(list [=expr =binop])]
165− ^- (unit [l=(interlist:interlist binop expr) =binop r=(list [=expr =binop])])
166+ ^- (unit [l=(interlist binop expr) =binop r=(list [=expr =binop])])
166− =/ reversed=(unit [l=(list [=binop =expr]) =binop r=(interlist:interlist binop expr)])
167+ =/ reversed=(unit [l=(list [=binop =expr]) =binop r=(interlist binop expr)])
167 =/ l=(list [=binop =expr]) (flop (turn l swap))
168 =/ l=(list [=binop =expr]) (flop (turn l swap))
168 |-
169 |-
169 ?~ l ~
170 ?~ l ~
170− ?: (is-pivot binop.i.l) `[~ binop.i.l (new:interlist expr.i.l t.l)]
171+ ?: (is-pivot binop.i.l) `[~ binop.i.l (new:inter expr.i.l t.l)]
171− =/ rest=(unit [l=(list [=binop =expr]) =binop r=(interlist:interlist binop expr)]) $(l t.l)
172+ =/ rest=(unit [l=(list [=binop =expr]) =binop r=(interlist binop expr)]) $(l t.l)
172 ?~ rest ~
173 ?~ rest ~
173 `[[i.l l.u.rest] +.u.rest]
174 `[[i.l l.u.rest] +.u.rest]
174 ?~ reversed ~
175 ?~ reversed ~
175− `[(reverse:interlist r.u.reversed) binop.u.reversed (turn (flop l.u.reversed) swap)]
176+ `[(reverse:inter r.u.reversed) binop.u.reversed (turn (flop l.u.reversed) swap)]
176 ++ swap |*([a=* b=*] [b a])
177 ++ swap |*([a=* b=*] [b a])
177 ++ process-right-assoc
178 ++ process-right-assoc
178 |= ops=(lest binop)
179 |= ops=(lest binop)
@@ -182,7 +183,7 @@ apex
182 %leaf
183 %leaf
183 =/ l +.tree
184 =/ l +.tree
184 |-
185 |-
185− =/ splitted (split-left-on:interlist |=(op=binop (elem op ops)) l)
186+ =/ splitted (split-left-on:inter |=(op=binop (elem op ops)) l)
186 ?~ splitted [%leaf l]
187 ?~ splitted [%leaf l]
187 [%node $(l lhs.u.splitted) pivot.u.splitted $(l rhs.u.splitted)]
188 [%node $(l lhs.u.splitted) pivot.u.splitted $(l rhs.u.splitted)]
188 %branch branch+[b.tree $(tree t.tree)]
189 %branch branch+[b.tree $(tree t.tree)]
@@ -208,7 +209,7 @@ apex
208 =/ l +.tree
209 =/ l +.tree
209 |-
210 |-
210 ^- working-tree
211 ^- working-tree
211− =/ splitted (split-right-on:interlist |=(op=binop (elem op ops)) l)
212+ =/ splitted (split-right-on:inter |=(op=binop (elem op ops)) l)
212 ?~ splitted [%leaf l]
213 ?~ splitted [%leaf l]
213 [%node $(l lhs.u.splitted) pivot.u.splitted $(l rhs.u.splitted)]
214 [%node $(l lhs.u.splitted) pivot.u.splitted $(l rhs.u.splitted)]
214 %tbd-unop
215 %tbd-unop
desk/res/lua/cycled/constructs.lua+2−2
@@ -28,7 +28,7 @@ a=(0x3 // 0x0)
28;
28;
29a=(0x0 % 0x0)
29a=(0x0 % 0x0)
30end
30end
31−assert((((0x2 ^ 0x3) ^ 0x2) == (0x2 ^ (0x3 ^ 0x2))))
31+assert(((0x2 ^ (0x3 ^ 0x2)) == (0x2 ^ (0x3 ^ 0x2))))
32;
32;
33assert((((0x2 ^ 0x3) * 0x4) == ((0x2 ^ 0x3) * 0x4)))
33assert((((0x2 ^ 0x3) * 0x4) == ((0x2 ^ 0x3) * 0x4)))
34;
34;
@@ -49,7 +49,7 @@ assert(((0xf0 | (0xcc ~ (0xaa & 0xfd))) == 0xf4))
49assert(((((0xfd & 0xaa) ~ 0xcc) | 0xf0) == 0xf4))
49assert(((((0xfd & 0xaa) ~ 0xcc) | 0xf0) == 0xf4))
50assert(((0xf0 & (0xf + 0x1)) == 0x10))
50assert(((0xf0 & (0xf + 0x1)) == 0x10))
51assert(((((0x3 ^ 0x4) // (0x2 ^ 0x3)) // 0x5) == 0x2))
51assert(((((0x3 ^ 0x4) // (0x2 ^ 0x3)) // 0x5) == 0x2))
52−assert((- (((0x3 + (((0x4 * 0x5) // ((0x2 ^ 0x3) ^ 0x2)) // 0x9)) + ((0x4 % 0xa) / 0x3)) == (((- 0x3) + (((0x4 * 0x5) // (0x2 ^ (0x3 ^ 0x2))) // 0x9)) + ((0x4 % 0xa) / 0x3)))))
52+assert((- (((0x3 + (((0x4 * 0x5) // (0x2 ^ (0x3 ^ 0x2))) // 0x9)) + ((0x4 % 0xa) / 0x3)) == (((- 0x3) + (((0x4 * 0x5) // (0x2 ^ (0x3 ^ 0x2))) // 0x9)) + ((0x4 % 0xa) / 0x3)))))
53assert((not ((true or false) and nil)))
53assert((not ((true or false) and nil)))
54assert((true or (false and nil)))
54assert((true or (false and nil)))
55assert(((((0x1 or false) and true) or false) == true))
55assert(((((0x1 or false) and true) or false) == true))
desk/sur/interlist.hoonnew file+8
@@ -0,0 +1,8 @@
1+|%
2+++ interlist
3+ |$ [sep val]
4+ $%
5+ [%double =val =sep tail=(interlist sep val)]
6+ [%single =val]
7+ ==
8+--