Definition at line 9 of file TestHM8.java.
◆ reset()
void com.cliffc.aa.HM.TestHM8.reset |
( |
| ) |
|
◆ test00()
void com.cliffc.aa.HM.TestHM8.test00 |
( |
| ) |
|
◆ test01()
void com.cliffc.aa.HM.TestHM8.test01 |
( |
| ) |
|
◆ test02()
void com.cliffc.aa.HM.TestHM8.test02 |
( |
| ) |
|
Definition at line 26 of file TestHM8.java.
27 Syntax syn = HM8.hm(
"(pair1 3)");
28 assertEquals(
"{ A -> (pair 3 A) }",syn._t.p());
29 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test03()
void com.cliffc.aa.HM.TestHM8.test03 |
( |
| ) |
|
Definition at line 33 of file TestHM8.java.
34 Syntax syn = HM8.hm(
"{ z -> (pair (z 3) (z \"abc\")) }");
35 assertEquals(
"{ { all -> A } -> (pair A A) }",syn._t.p());
36 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test04()
void com.cliffc.aa.HM.TestHM8.test04 |
( |
| ) |
|
Definition at line 40 of file TestHM8.java.
41 Syntax syn = HM8.hm(
"fact = { n -> (if (?0 n) 1 (* n (fact (dec n))))}; fact");
42 assertEquals(
"{ int64 -> int64 }",syn._t.p());
43 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test05()
void com.cliffc.aa.HM.TestHM8.test05 |
( |
| ) |
|
Definition at line 54 of file TestHM8.java.
57 Syntax syn = HM8.hm(
"({ x -> (pair (x 3) (x \"abc\")) } {y->y})");
58 assertEquals(
"(pair all all)",syn._t.p());
59 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test05a()
void com.cliffc.aa.HM.TestHM8.test05a |
( |
| ) |
|
Definition at line 47 of file TestHM8.java.
48 Syntax syn = HM8.hm(
"id={x->x}; (pair (id 3) (id \"abc\"))");
49 assertEquals(
"(pair 3 \"abc\")",syn._t.p());
50 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test06()
void com.cliffc.aa.HM.TestHM8.test06 |
( |
| ) |
|
Definition at line 63 of file TestHM8.java.
65 Syntax syn = HM8.hm(
"{ f -> (f f) }");
66 assertEquals(
"{ A:{ $A -> B } -> B }",syn._t.p());
67 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test07()
void com.cliffc.aa.HM.TestHM8.test07 |
( |
| ) |
|
Definition at line 73 of file TestHM8.java.
74 Syntax syn = HM8.hm(
"g = {f -> 5}; (g g)");
75 assertEquals(
"5",syn._t.p());
76 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test08()
void com.cliffc.aa.HM.TestHM8.test08 |
( |
| ) |
|
Definition at line 80 of file TestHM8.java.
82 Syntax syn = HM8.hm(
"{ g -> f = { x -> g }; (pair (f 3) (f \"abc\"))}");
83 assertEquals(
"{ A -> (pair A A) }",syn._t.p());
84 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test09()
void com.cliffc.aa.HM.TestHM8.test09 |
( |
| ) |
|
Definition at line 88 of file TestHM8.java.
89 Syntax syn = HM8.hm(
"{ f g -> (f g)}");
90 assertEquals(
"{ { A -> B } A -> B }",syn._t.p());
91 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test10()
void com.cliffc.aa.HM.TestHM8.test10 |
( |
| ) |
|
Definition at line 95 of file TestHM8.java.
97 Syntax syn = HM8.hm(
"{ f g -> { arg -> (g (f arg))} }");
98 assertEquals(
"{ { A -> B } { B -> C } -> { A -> C } }",syn._t.p());
99 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test11()
void com.cliffc.aa.HM.TestHM8.test11 |
( |
| ) |
|
Definition at line 103 of file TestHM8.java.
105 Syntax syn = HM8.hm(
"map = { fun -> { x -> 2 } }; ((map 3) 5)");
106 assertEquals(
"2",syn._t.p());
107 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test12()
void com.cliffc.aa.HM.TestHM8.test12 |
( |
| ) |
|
Definition at line 111 of file TestHM8.java.
113 Syntax syn = HM8.hm(
"map = { fun -> { x -> (fun x)}}; { p -> 5 }");
114 assertEquals(
"{ A -> 5 }",syn._t.p());
115 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test13()
void com.cliffc.aa.HM.TestHM8.test13 |
( |
| ) |
|
Definition at line 119 of file TestHM8.java.
123 Syntax syn = HM8.hm(
"map = { fun -> { x -> (fun x)}};"+
124 "(pair ((map str) 5) ((map factor) 2.3))");
125 assertEquals(
"(pair str (divmod flt64 flt64))",syn._t.p());
126 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test14()
void com.cliffc.aa.HM.TestHM8.test14 |
( |
| ) |
|
Definition at line 130 of file TestHM8.java.
132 Syntax syn = HM8.hm(
"map = { fun x -> (fun x)}; (map {a->3} 5)");
133 assertEquals(
"3",syn._t.p());
134 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test15()
void com.cliffc.aa.HM.TestHM8.test15 |
( |
| ) |
|
Definition at line 138 of file TestHM8.java.
140 Syntax syn = HM8.hm(
"map = { fun x -> (fun x)}; (map { a-> (pair a a)} 5)");
141 assertEquals(
"(pair 5 5)",syn._t.p());
142 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test16()
void com.cliffc.aa.HM.TestHM8.test16 |
( |
| ) |
|
Definition at line 146 of file TestHM8.java.
147 Syntax syn = HM8.hm(
"fcn = { p -> { a -> (pair a a) }};"+
148 "map = { fun x -> (fun x)};"+
149 "{ q -> (map (fcn q) 5)}");
150 assertEquals(
"{ A -> (pair 5 5) }",syn._t.p());
151 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test17()
void com.cliffc.aa.HM.TestHM8.test17 |
( |
| ) |
|
Definition at line 155 of file TestHM8.java.
167 Syntax syn = HM8.hm(
"fcn = {p -> (if p {a -> (pair a a)} {b -> (pair b (pair 3 b))})};"+
168 "map = { fun x -> (fun x)};"+
169 "{ q -> (map (fcn q) 5)}");
170 assertEquals(
"{ A -> (pair Cannot unify $V123:(pair 3 $V123) and 5 Cannot unify $V123:(pair 3 $V123) and 5) }",syn._t.p());
171 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test18()
void com.cliffc.aa.HM.TestHM8.test18 |
( |
| ) |
|
Definition at line 175 of file TestHM8.java.
176 Syntax syn = HM8.hm(
"cons ={x y-> {cadr -> (cadr x y)}};"+
177 "cdr ={mycons -> (mycons { p q -> q})};"+
179 assertEquals(
"3",syn._t.p());
180 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test19()
void com.cliffc.aa.HM.TestHM8.test19 |
( |
| ) |
|
Definition at line 191 of file TestHM8.java.
192 Syntax syn = HM8.hm(
"cons ={x y-> {cadr -> (cadr x y)}};"+
193 "cdr ={mycons -> (mycons { p q -> q})};"+
194 "map ={fun parg -> (fun (cdr parg))};"+
195 "(pair (map str (cons 0 5)) (map isempty (cons 0 \"abc\")))"
197 assertEquals(
"(pair str int1)",syn._t.p());
198 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test20()
void com.cliffc.aa.HM.TestHM8.test20 |
( |
| ) |
|
Definition at line 203 of file TestHM8.java.
204 Syntax syn = HM8.hm(
"f0 = { f x -> (if (?0 x) 1 (f (f0 f (dec x)) 2))}; (f0 * 99)");
205 assertEquals(
"int64",syn._t.p());
206 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test21()
void com.cliffc.aa.HM.TestHM8.test21 |
( |
| ) |
|
Definition at line 211 of file TestHM8.java.
214 Syntax syn = HM8.hm(
"f0 = { f x -> (if (?0 x) 1 (* (f0 f (dec x)) 2))}; (f0 f0 99)");
215 assertEquals(
"int64",syn._t.p());
216 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test22()
void com.cliffc.aa.HM.TestHM8.test22 |
( |
| ) |
|
Definition at line 221 of file TestHM8.java.
222 Syntax syn = HM8.hm(
"is_even = "+
223 " is_odd = { n -> (if (?0 n) 0 (is_even (dec n)))}; "+
224 " { n -> (if (?0 n) 1 (is_odd (dec n)))};"+
227 assertEquals(
"int1",syn._t.p());
228 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test23()
void com.cliffc.aa.HM.TestHM8.test23 |
( |
| ) |
|
Definition at line 233 of file TestHM8.java.
234 Syntax syn = HM8.hm(
"{ g -> fgz = "+
235 " cons = {x y -> {cadr -> (cadr x y)}};"+
236 " cdr = {mycons -> (mycons { p q -> q})};"+
237 " (cdr (cons 2 { z -> (g z) }));"+
238 " (pair (fgz 3) (fgz 5))"+
241 assertEquals(
"{ { nint8 -> A } -> (pair A A) }",syn._t.p());
242 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test24()
void com.cliffc.aa.HM.TestHM8.test24 |
( |
| ) |
|
Definition at line 247 of file TestHM8.java.
248 Syntax syn = HM8.hm(
"@{x=2, y=3}");
249 assertEquals(
"*[7]@{ x = 2, y = 3}",syn._t.p());
250 assertEquals(
"[ 7:*[7]@{ x = 2, y = 3}]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test25()
void com.cliffc.aa.HM.TestHM8.test25 |
( |
| ) |
|
Definition at line 255 of file TestHM8.java.
256 Syntax syn = HM8.hm(
".x @{x =2, y =3}");
257 assertEquals(
"2",syn._t.p());
258 assertEquals(
"[ 7:*[7]@{ x = 2, y = 3}]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test25a()
void com.cliffc.aa.HM.TestHM8.test25a |
( |
| ) |
|
Definition at line 263 of file TestHM8.java.
264 Syntax syn = HM8.hm(
".x 5");
265 assertEquals(
"Cannot unify *[-2]@{ x = V24} and 5",syn._t.p());
266 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test25b()
void com.cliffc.aa.HM.TestHM8.test25b |
( |
| ) |
|
Definition at line 271 of file TestHM8.java.
272 Syntax syn = HM8.hm(
".x @{ y =3}");
273 assertEquals(
"Missing field x in *[7]@{ y = 3, x = all}",syn._t.p());
274 assertEquals(
"[ 7:*[7]@{ y = 3, x = Missing field x in *[7]@{ y = 3, x = all}}]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test26()
void com.cliffc.aa.HM.TestHM8.test26 |
( |
| ) |
|
Definition at line 278 of file TestHM8.java.
279 Syntax syn = HM8.hm(
"{ g -> @{x=g, y=g}}");
280 assertEquals(
"{ A -> *[7]@{ x = A, y = A} }",syn._t.p());
281 assertEquals(
"[ 7:*[7]@{ x = A, y = A}]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test27()
void com.cliffc.aa.HM.TestHM8.test27 |
( |
| ) |
|
Definition at line 285 of file TestHM8.java.
287 Syntax syn = HM8.hm(
"{ pred -> .x (if pred @{x=2,y=3} @{x=3,z= \"abc\"}) }");
288 assertEquals(
"{ A -> nint8 }",syn._t.p());
289 assertEquals(
"[ 7:A:*[7,8]@{ x = nint8, z = all, y = all}, 8:$A]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test28()
void com.cliffc.aa.HM.TestHM8.test28 |
( |
| ) |
|
Definition at line 293 of file TestHM8.java.
296 Syntax syn = HM8.hm(
"{ sq -> (* .x sq .y sq) }");
297 assertEquals(
"{ *[-2]@{ y = int64, x = int64} -> int64 }",syn._t.p());
298 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test29()
void com.cliffc.aa.HM.TestHM8.test29 |
( |
| ) |
|
Definition at line 302 of file TestHM8.java.
304 Syntax syn = HM8.hm(
"map = { fcn lst -> @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } }; map");
305 assertEquals(
"{ { A -> B } C:*[-2]@{ v0 = A, n0 = $C} -> D:*[7]@{ n1 = $D, v1 = B} }",syn._t.p());
306 assertEquals(
"[ 7:A:*[7]@{ n1 = $A, v1 = B}]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test30()
void com.cliffc.aa.HM.TestHM8.test30 |
( |
| ) |
|
Definition at line 310 of file TestHM8.java.
314 Syntax syn = HM8.hm(
"map = { fcn lst -> (if lst @{ n1=(map fcn .n0 lst), v1=(fcn .v0 lst) } nil) }; map");
315 assertEquals(
"{ { A -> B } C:*[-2]@{ v0 = A, n0 = $C}? -> D:*[7]@{ n1 = $D, v1 = B}? }",syn._t.p());
316 assertEquals(
"[ 7:A:*[7]@{ n1 = $A, v1 = B}?]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test30a()
void com.cliffc.aa.HM.TestHM8.test30a |
( |
| ) |
|
Definition at line 320 of file TestHM8.java.
322 Syntax syn = HM8.hm(
"map = { fcn lst -> (if lst @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } nil) }; (map dec @{n0 = nil, v0 = 5})");
323 assertEquals(
"A:*[7]@{ n1 = $A, v1 = int64}?",syn._t.p());
324 assertEquals(
"[ 7:A:*[7]@{ n1 = $A, v1 = B}?, 8:*[8]@{ n0 = (Nil), v0 = int64}?]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test31()
void com.cliffc.aa.HM.TestHM8.test31 |
( |
| ) |
|
Definition at line 329 of file TestHM8.java.
331 Syntax syn = HM8.hm(
"p0 = { x y z -> (triple x y z) };"+
332 "p1 = (triple p0 p0 p0);"+
333 "p2 = (triple p1 p1 p1);"+
334 "p3 = (triple p2 p2 p2);"+
336 assertEquals(
"(triple (triple (triple { A B C -> (triple A B C) } { D E F -> (triple D E F) } { G H I -> (triple G H I) }) (triple { J K L -> (triple J K L) } { M N O -> (triple M N O) } { P Q R -> (triple P Q R) }) (triple { S T U -> (triple S T U) } { V21 V22 V23 -> (triple V21 V22 V23) } { V24 V25 V26 -> (triple V24 V25 V26) })) (triple (triple { V27 V28 V29 -> (triple V27 V28 V29) } { V30 V31 V32 -> (triple V30 V31 V32) } { V33 V34 V35 -> (triple V33 V34 V35) }) (triple { V36 V37 V38 -> (triple V36 V37 V38) } { V39 V40 V41 -> (triple V39 V40 V41) } { V42 V43 V44 -> (triple V42 V43 V44) }) (triple { V45 V46 V47 -> (triple V45 V46 V47) } { V48 V49 V50 -> (triple V48 V49 V50) } { V51 V52 V53 -> (triple V51 V52 V53) })) (triple (triple { V54 V55 V56 -> (triple V54 V55 V56) } { V57 V58 V59 -> (triple V57 V58 V59) } { V60 V61 V62 -> (triple V60 V61 V62) }) (triple { V63 V64 V65 -> (triple V63 V64 V65) } { V66 V67 V68 -> (triple V66 V67 V68) } { V69 V70 V71 -> (triple V69 V70 V71) }) (triple { V72 V73 V74 -> (triple V72 V73 V74) } { V75 V76 V77 -> (triple V75 V76 V77) } { V78 V79 V80 -> (triple V78 V79 V80) })))",syn._t.p());
337 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test32()
void com.cliffc.aa.HM.TestHM8.test32 |
( |
| ) |
|
Definition at line 343 of file TestHM8.java.
345 Syntax syn = HM8.hm(
"map = { lst -> (if lst @{ n1= arg= .n0 lst; (if arg @{ n1=(map .n0 arg), v1=(str .v0 arg)} nil), v1=(str .v0 lst) } nil) }; map");
346 assertEquals(
"{ A:*[-2]@{ v0 = int64, n0 = *[-2]@{ n0 = $A, v0 = int64}?}? -> B:*[8]@{ n1 = *[7]@{ n1 = $B, v1 = str}?, v1 = str}? }",syn._t.p());
347 assertEquals(
"[ 7:A:*[7]@{ n1 = B:*[8]@{ n1 = $A, v1 = str}?, v1 = str}?, 8:$B]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test33()
void com.cliffc.aa.HM.TestHM8.test33 |
( |
| ) |
|
Definition at line 351 of file TestHM8.java.
352 Syntax syn = HM8.hm(
"x = { y -> (x (y y))}; x");
353 assertEquals(
"{ A:{ $A -> $A } -> B }",syn._t.p());
354 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test34()
void com.cliffc.aa.HM.TestHM8.test34 |
( |
| ) |
|
Definition at line 358 of file TestHM8.java.
361 Syntax syn = HM8.hm(
"{ x -> y = ( x .v x ); 0}");
362 assertEquals(
"{ Cannot unify *[-2]@{ v = V40} and { V40 -> V34 } -> 0 }",syn._t.p());
363 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test35()
void com.cliffc.aa.HM.TestHM8.test35 |
( |
| ) |
|
Definition at line 367 of file TestHM8.java.
368 Syntax syn = HM8.hm(
"x = { z -> z}; (x { y -> .u y})");
369 assertEquals(
"{ *[-2]@{ u = A} -> A }",syn._t.p());
370 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
◆ test36()
void com.cliffc.aa.HM.TestHM8.test36 |
( |
| ) |
|
Definition at line 374 of file TestHM8.java.
379 Syntax syn = HM8.hm(
"x = w = (x x); { z -> z}; (x { y -> .u y})");
380 assertEquals(
"Cannot unify $V66:{ $V66 -> V67 } and *[-2]@{ u = V39}",syn._t.p());
381 assertEquals(
"[]",syn._post.p());
References com.cliffc.aa.HM.HM8.hm().
The documentation for this class was generated from the following file: