Fix Cyc_has_cycle to compare cons cells

Compare the cons cells themselves - instead of values - to determine if there is a cycle. By definition the pointers will be different unless there is a cycle.
This commit is contained in:
Justin Ethier 2016-07-02 02:42:32 -04:00
parent 439bda440d
commit 02e8b343c7

View file

@ -540,9 +540,7 @@ object Cyc_has_cycle(object lst)
return boolean_f;
if (Cyc_is_pair(cdr(fast_lst)) == boolean_f)
return boolean_f;
if (is_object_type(car(slow_lst)) && boolean_f == Cyc_is_boolean(car(slow_lst)) && // Avoid expected dupes
//boolean_f == Cyc_is_symbol(car(slow_lst)) && //
(car(slow_lst) == car(fast_lst)))
if (slow_lst == fast_lst)
return boolean_t;
slow_lst = cdr(slow_lst);