From 92bc8e2f4cc7804d16aba5ac952afe8895b80a9d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 6 Apr 2024 09:36:30 -0700 Subject: [PATCH] Fixed comparison of registers --- examples/test.modal | 7 +++---- src/modal.c | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/test.modal b/examples/test.modal index 9f87333..11430ac 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,5 +1,4 @@ -<> (a) (apple) -<> (b) (banana) -<> (apple banana) (fruit salad) +<> (eq ?x ?x) (#t) +<> (eq ?x ?y) (#f) -a b \ No newline at end of file +(eq foo bar) (eq foo foo) \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index 3c5786f..2c23d60 100644 --- a/src/modal.c +++ b/src/modal.c @@ -36,9 +36,9 @@ static int compare(char *a, char *b) { int i = 0, al = walk(a) - a, bl = walk(b) - b; - if(al != bl) - while(a[i] == b[i]) - if(!a[i] || ++i >= al) return 1; + if(al != bl) return 0; + while(a[i] == b[i]) + if(!a[i] || ++i >= al) return 1; return 0; }