modal/examples/tests.modal

47 lines
786 B
Plaintext
Raw Normal View History

2024-04-15 19:26:25 -04:00
?(?-) (This example tests various aspects of the implementation.)
2024-04-15 20:18:18 -04:00
<> (?: print) (?:)
<> (?x = ?x test) (#ok)
<> (?x = ?y test) (#fail)
2024-04-15 22:47:11 -04:00
?(?-) (Empty replacements)
<> (?x pop-plain)
<> (?x pop) ()
abc def pop-plain = abc test
abc def pop = abc test
?(?-) (Basic replacements)
<> (replace-name (foo)) ((bar) =)
replace-name (foo) (bar) test
2024-04-15 20:18:18 -04:00
?(?-) (Basic register setups)
<> (dup (?x)) ((?x ?x) =)
<> (swap (?x ?y)) ((?y ?x) =)
<> (compare (?x ?x ?x)) ((#t) =)
dup (abc) (abc abc) test
swap (abc def) (def abc) test
compare (abc abc abc) (#t) test
?(?-) (Lambdas)
?((?x) ((?x ?x) =)) abc (abc abc) test
2024-04-15 22:47:11 -04:00
abc ?(?x) def = abc test
?(?-) (Explode)
<> (explode ?*) ((?*) =)
explode cow (c (o (w ()))) test
?(?-) (Implode)
<> (implode ?*) (?* =)
2024-04-04 20:15:16 -04:00
2024-04-15 22:47:11 -04:00
implode (b (a (t ()))) bat test