Arc Forumnew | comments | leaders | submitlogin
2 points by nlavine 5937 days ago | link | parent

Hmm. The obvious implementation to me seems to be this:

  (def slice (seq start (o end (len seq)))
    (subseq seq (mod start (len seq)) (mod end (len seq))))
However, this would give slice meaning for indices outside the length of the sequence, by modding them back into the range. Is this ever actually useful? (Perhaps in some sort of loop that doesn't know the range of the sequence? Maybe you want something that looks like an infinitely long sequence but is actually a cycle of some length?)