title: Understanding moving window calcs in kdb
body: <p>I'm struggling to understand this q code programming idiom from the kx cookbook:</p>
  
  <pre><code>q)swin:{[f;w;s] f each { 1_x,y }\[w#0;s]}
  q)swin[avg; 3; til 10]
  0 0.33333333 1 2 3 4 5 6 7 8
  </code></pre>
  
  <p>The notation is confusing.  Is there an easy way to break it down as a beginner?</p>
  
  <p>I get that the compact notation for the function is probably equivalent to this</p>
  
  <pre><code>swin:{[f;w;s] f each {[x; y] 1_x, y }\[w#0;s]}
  </code></pre>
  
  <p><code>w#0</code> means repeat 0 w times (<code>w</code> is some filler for the first couple of observations?), and <code>1_x, y</code> means join x, after dropping the first observation, to y.  But I don't understand how this then plays out with <code>f = avg</code> applied with each.  Is there a way to understand this easily?</p>