anchor.diff:  // n0 The number of mesh points to use in the uniform discretization
   // of the interval @(min,max)@.  If this value is not a power of
   // two, then it is rounded up to the next power of two.
  -let kde n0 (xs:float[]) =
  -    if(xs = null) then failwith "empty sample"     
  +let kde n0 (xs:float seq) =
  +    if(xs = null) then invalidArg "sample" "cannot be empty"
       else
           let mutable max = System.Double.MinValue
           let mutable min = System.Double.MaxValue
           let range =         
  -            if xs.Length = 0 then 
  +            if Seq.isEmpty xs then 
                   min <- 0.0
                   max <- 0.0
                   1.0  // unreasonable guess
               else
  -                for i in 0 .. xs.Length - 1 do
  -                  if max < (xs.[i]) then 
  -                       max <- xs.[i]
  -                  if min > (xs.[i]) then 
  -                       min <- xs.[i]
  -                if min = max then 1.0 else max - min
  +                xs |> Seq.iter (fun xsi -> 
  +                  if max < (xsi) then 
  +                       max <- xsi
  +                  if min > (xsi) then 
  +                       min <- xsi)
  +                if min >= max then 1.0 else max - min
           kde2 n0 (min - range/10.0) (max + range/10.0) xs
positive.code: // n0 The number of mesh points to use in the uniform discretization
  // of the interval @(min,max)@.  If this value is not a power of
  // two, then it is rounded up to the next power of two.
  // min Lower bound (@min@) of the mesh range.
  // max Upper bound (@max@) of the mesh range.
  let kde2 n0 min max (sample:float[]) =
      if sample = null || sample.Length = 0 then failwith "Empty sample"
      else if(n0 = 1) then failwith "Invalid number of points"
      else
          let xs = Array.filter (System.Double.IsNaN >> not) sample
          let m_sqrt_2_pi = sqrt (2.0*pi)
          let m_sqrt_pi = sqrt pi
          let r = max - min
  
negative.code:             | Odd(z) -> vals.[len - hz - 1]
      [| for i in 0..len-1 do yield interleave(i) |]
  
  // http://hackage.haskell.org/package/statistics-0.10.5.0/docs/src/Statistics-Function.html#nextHighestPowerOfTwo
  //
  // Efficiently compute the next highest power of two for a
  // non-negative integer.  If the given value is already a power of
  // two, it is returned unchanged.  If negative, zero is returned.
  let nextHighestPowerOfTwo n =
    let   i0   = n - 1
    let   i1   = i0  ||| (i0 >>> 1)
  