modal/examples/tests.modal

81 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-04-15 19:26:25 -04:00
?(?-) (This example tests various aspects of the implementation.)
2024-04-15 23:39:25 -04:00
?(?-) (Inline rules)
<> ((?x -> ?y)) (<> ?x ?y)
(nap -> (tap =))
nap tap test
2024-04-15 22:47:11 -04:00
?(?-) (Empty replacements)
<> (?x pop-plain)
<> (?x pop) ()
2024-04-17 14:40:47 -04:00
<> (ghost) ()
2024-04-15 22:47:11 -04:00
abc def pop-plain = abc test
abc def pop = abc test
2024-04-17 14:49:32 -04:00
(ghost) = () test
2024-04-15 22:47:11 -04:00
?(?-) (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
2024-04-15 23:13:08 -04:00
?(?-) (Empty register replacement)
<> (replace-empty ?x) (?y)
replace-empty abc = ?y test
2024-04-15 23:58:16 -04:00
?(?-) (Guards setups)
<> (join (String ?x) (String ?y)) ((?x ?y) =)
join (String abc) (String def) (abc def) test
2024-04-15 20:18:18 -04:00
?(?-) (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
2024-04-17 13:56:51 -04:00
explode (12 34 45) (12 (34 (45 ()))) test
2024-04-15 22:47:11 -04:00
?(?-) (Implode)
2024-04-17 13:56:51 -04:00
<> (implode ?^) (?^ =)
2024-04-04 20:15:16 -04:00
2024-04-15 22:47:11 -04:00
implode (b (a (t ()))) bat test
2024-04-17 13:56:51 -04:00
implode (12 (34 (56 ()))) 123456 test
2024-04-15 23:39:25 -04:00
2024-04-17 14:49:32 -04:00
?(?-) (Test Primitives)
<> (?: print) (?:)
<> (?x = ?x test) (#ok)
<> (?x = ?y test) (#fail)
2024-04-15 23:39:25 -04:00
?(?-) (List reversal)
2024-04-17 13:56:51 -04:00
<> (reverse List () ?^) (?^)
2024-04-15 23:39:25 -04:00
<> (reverse (?*)) (reverse List (?*) ())
<> (reverse List (?x ?y) ?z) (reverse List ?y (?x ?z))
reverse (modal) = ladom test
2024-04-17 14:49:32 -04:00