Replace `in-cycle' with a version that checks for emptiness and doesn't loop forever

Closes PR13620
Use sequence/c's #:min-count for better error messages in `lines' and others

Closes PR13709