modal/examples/tests.modal

53 lines
879 B
Plaintext

?(?-) (This example tests various aspects of the implementation.)
<> (?: print) (?:)
<> (?x = ?x test) (#ok)
<> (?x = ?y test) (#fail)
?(?-) (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
?(?-) (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
?(?-) (Empty register replacement)
<> (replace-empty ?x) (?y)
replace-empty abc = ?y test
?(?-) (Lambdas)
?((?x) ((?x ?x) =)) abc (abc abc) test
abc ?(?x) def = abc test
?(?-) (Explode)
<> (explode ?*) ((?*) =)
explode cow (c (o (w ()))) test
?(?-) (Implode)
<> (implode ?*) (?* =)
implode (b (a (t ()))) bat test