mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-09 22:17:33 +02:00
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:
parent
439bda440d
commit
02e8b343c7
1 changed files with 1 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue