@programmingpraxis: Yes, my lists are plain finite lists. I was under the impression that the ‘unique’ part of the cyclic list (i.e. the part that’s repeated over and over) is known and provided as input to the function. If instead you are given two cyclical lists then this version obviously doesn’t work and things get a lot trickier, since Haskell doesn’t normally expose pointers and as such lacks the option to ‘point to the start of the list’, making it impossible to determine the length of the cycle. In Haskell, cycling a list is simply a matter of infinitely and lazily repeating the elements, which provides no indication that the cycle has been completed.
Ignoring that little practical problem, the basic idea of the solution can remain the same; you just have to create the two finite lists first. Start at any element, collecting them all until the loop is closed. Then use the solution presented above.

]]>