Fixed mistake in arithmetic

This commit is contained in:
Devine Lu Linvega 2024-04-06 10:59:44 -07:00
parent 0fda93ec0e
commit a0bb670722
2 changed files with 9 additions and 10 deletions

View File

@ -2,22 +2,18 @@
<> (add (s ?x) (0)) (s ?x)
<> (add (0) (s ?y)) (s ?y)
<> (add (0) (0)) (0)
<> (sub (s ?x) (s ?y)) (sub ?x ?y)
<> (sub (s ?x) (0)) (s ?x)
<> (sub (0) (s ?y)) (s ?y)
<> (sub (0) (0)) (0)
<> (mul (s ?x) (s ?y)) (add (s ?x) (mul (s ?x) (sub (s ?y) (s (0)))))
<> (mul (s ?x) (s (0)) (s ?x)
<> (mul (s (0)) (s ?y) (s ?y)
<> (mul (s ?x) (s (0))) (s ?x)
<> (mul (s (0)) (s ?y)) (s ?y)
<> (mul (s ?x) (0)) (0)
<> (mul (0) (s ?x)) (0)
<> (?x + ?y) (add ?x ?y)
<> (?x - ?y) (sub ?x ?y)
<> (?x * ?y) (mul ?x ?y)
<> (factorial (s (0))) ((s (0)))
<> (factorial (s ?x)) (((s ?x) * factorial ((s ?x) - (s (0)))))

View File

@ -1,5 +1,8 @@
<> (a) (apple)
<> (b) (banana)
<> (apple banana) (fruit salad)
<> (eq ?x ?x) (#t)
<> (eq ?x ?y) (#f)
<> (q ?x) (q ?x)
<> (if ?c ?t ?f) (if/q ?c q ?t q ?f)
<> (if/q (#t) q ?t q ?f) (?t)
<> (if/q (#f) q ?t q ?f) (?f)
a b
if (eq foo bar) (if (eq foo baz) a b) (if (eq foo foo) b c)