Jump to content

Cycle detection: Difference between revisions

→‎Functional Python: Edited docstrings to distinguish recursive and non-recursive drafts.
m (→‎Functional Python: (added a works with tag))
(→‎Functional Python: Edited docstrings to distinguish recursive and non-recursive drafts.)
Line 1,329:
{{Trans|Haskell}}
{{Works with|Python|3.7}}
<lang python>'''Cycle detection by recursion.'''
 
from itertools import (chain, cycle, islice)
Line 1,629:
The Python no longer falls out of the tree at the sight of an ouroboros, and we can happily search for cycles in lists of several thousand items:
{{Works with|Python|3.7}}
<lang python>'''Cycle detection without recursion.'''
 
from itertools import (chain, cycle, islice)
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.