title: How to create infinitely repeating list in Haskell?
body: <p>I'm a C# guy trying to teach myself Haskell from Erik Meijer's Channel 9 webcasts. I came across an interesting puzzle which involved skipping every 'n' elements of a list using zip and mod.</p>
  
  <pre><code>every :: Int -&gt; [a] -&gt; [a]
  every _ [] = []
  every n xs = [x | (x,i) &lt;- zip xs [1..], i `mod` n == 0]
  </code></pre>
  
  <p>I've been thinking it might be more efficient (for really large lists, or streams) if we could avoid using mod.</p>
  
  <p>I thought about lazily creating a repeating list of integers so we can simply compare the value of i to n.</p>
  
  <pre><code>repeatInts :: Int -&gt; [Int]
  </code></pre>
  
  <p>such that calling <code>repeatInts 3</code> returns <code>[1,2,3,1,2,3,1,2,3,1,2,3,..]</code> ad infinitum.</p>
  
  <p>Given this, we could redefine <code>every</code> like so:</p>
  
  <pre><code>every :: Int -&gt; [a] -&gt; [a]
  every _ [] = []
  every n xs = [x | (x,i) &lt;- zip xs (repeatInts n), i == n]
  </code></pre>
  
  <p>So my questions is: how would you implement <code>repeatInts</code>?</p>