anchor.diff:  Series windowing and chunking
   -----------------------------
   
  -## Aa
  - - ffooo
  -
  -*)
  -
  -let x = 42
  +### Sliding windows
  +
  +basic stuff
  +*)
  +
  +let lf = series <| stock1 (TimeSpan(0, 1, 0)) 6
  +
  +lf |> Series.window 4
  +lf |> Series.windowInto 4 Series.mean
  +lf |> Series.windowInto 4 Series.firstValue
  +
  +(**
  +
  +More features
  +
  +*)
  +let lfm1 = lf |> Series.windowInto 4 Series.mean
  +Frame.ofColumns [ "Orig" => lf; "Means" => lfm1 ]
  +// [fsi:val it : Frame<DateTimeOffset,string> =]
  +// [fsi:                 Means      Orig        ]     
  +// [fsi:  12:00:00 AM -> <missing>  20.16]
  +// [fsi:  12:01:00 AM -> <missing>  20.32]
  +// [fsi:  12:02:00 AM -> <missing>  20.25]
  +// [fsi:  12:03:00 AM -> 20.30      20.45]
  +// [fsi:  12:04:00 AM -> 20.34      20.32]
  +// [fsi:  12:05:00 AM -> 20.34      20.33]
  +
  +let lfm2 = 
  +  lf |> Series.windowSizeInto (4, Boundary.AtBeginning) (fun ds ->
  +    Series.mean ds.Data)
  +
  +Frame.ofColumns [ "Orig" => lf; "Means" => lfm2 ]
  +// [fsi:val it : Frame<DateTimeOffset,string> =]
  +// [fsi:                 Means  Orig        ]     
  +// [fsi:  12:00:00 AM -> 20.16  20.16]
  +// [fsi:  12:01:00 AM -> 20.24  20.32]
  +// [fsi:  12:02:00 AM -> 20.24  20.25]
  +// [fsi:  12:03:00 AM -> 20.30  20.45]
  +// [fsi:  12:04:00 AM -> 20.34  20.32]
  +// [fsi:  12:05:00 AM -> 20.34  20.33]
  +
  +(**
  +One more example
  +*)
  +
  +let st = Series.ofValues [ 'a' .. 'j' ]
  +st |> Series.chunkSizeInto (3, Boundary.AtEnding) (function
  +  | DataSegment.Complete(ser) -> 
  +      String(ser |> Series.values |> Array.ofSeq)
  +  | DataSegment.Incomplete(ser) -> 
  +      String(ser |> Series.values |> Array.ofSeq).PadRight(3, '-') )  
  +
  +(**
  +
  +### Window size conditions
  +
  +*)
  +let daily = series <| stock1 (TimeSpan(35, 0, 0)) 10
  +daily |> Series.windowDist (TimeSpan(24, 0, 0))
  +
  +daily |> Series.windowWhile (fun d1 d2 -> d1.Date = d2.Date)
  +
  +(**
  +
  +### Chunking
  +*)
  +
  +let hf = series <| stock1 (TimeSpan(0, 0, 1)) 600
  +
  +hf |> Series.chunkDist (TimeSpan(0, 1, 0))
  +
   
   (**
   <a name="sampling"></a>
  
positive.code: Calculations and statistics
  ---------------------------
  
  *)
  
  (*** hide ***)
  
negative.code: let keys = [ for d in 12 .. 20 -> DateTime(2012, 2, d) ]
  inp3 |> Series.sample keys Direction.Forward
  
  
  (*
  Operations
  