aboutsummaryrefslogtreecommitdiff
path: root/builtin.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-09 22:18:39 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-09 22:18:39 +0800
commit1985734990b5c5ab3fd50277bff854ea3cd92b2c (patch)
treed3e3843ef7b4779400addc1c53ebd8956a3f0995 /builtin.cpp
parent155c3e5d46909d36d9f595e2a3b8d786240b9520 (diff)
fixed bug in `equal?`
Diffstat (limited to 'builtin.cpp')
-rw-r--r--builtin.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin.cpp b/builtin.cpp
index 98090e0..115377c 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -1335,9 +1335,8 @@ do { \
int otype = (a = *l1)->get_otype();
if (otype != (b = *l2)->get_otype())
return new BoolObj(false);
- if (a == empty_list)
- continue;
- if (otype & CLS_PAIR_OBJ)
+ if (a != empty_list && b != empty_list &&
+ otype & CLS_PAIR_OBJ)
{
*r1 = TO_PAIR(a)->car;
INC1(r1);
@@ -1363,7 +1362,7 @@ do { \
it = va->vec.begin();
it != va->vec.end(); it++)
{
- *r1 = TO_PAIR(a)->car;
+ *r1 = *it;
INC1(r1);
CHK1;
}
@@ -1372,7 +1371,7 @@ do { \
it = vb->vec.begin();
it != vb->vec.end(); it++)
{
- *r2 = TO_PAIR(b)->car;
+ *r2 = *it;
INC2(r2);
CHK2;
}
@@ -1418,6 +1417,8 @@ do { \
static_cast<StrObj*>(b)->str)
return new BoolObj(false); // (string=?)
}
+ else if (a != b)
+ return new BoolObj(false);
}
return new BoolObj(true);
}