computeDistance :: Int -> [B.ByteString] -> (Int, Double)
computeDistance sz bss =
  let
    -- helper function to get the average of a list of Doubles
    -- uses List.genericLength to get the length of List as Double,
    -- instead of Int.
    average l =
      sum l / (List.genericLength l)

    -- make the list of bytestrings into tuple pairs
    -- so [a, b, c, d, ..] becomes [(a, b), (c, d), ..]
    -- pairs els =
    --   Split.splitEvery 2 els
    --   |> pairs'

    pairs els =
      case els of
        [] ->
          []
        a:[] ->
          []
        a:b:rest ->
          (a,b):(pairs rest)

    normalise d =
      (fromIntegral d) / (fromIntegral sz)

    -- create the pairs, feed them into the Hamming Function
    -- normalise per byte (or, more actually word8)
    -- and then compute the average
    averageDistance =
      pairs bss
      |> map Hamming.bytestrings  -- step 2: see Crypto.HammingDistance
      |> map normalise
      |> average
  in
    -- return the tuple of the size and the average distance
    (sz, averageDistance)
computeDistance :: Int -> [B.ByteString] -> (Int, Double)
computeDistance sz bss =
  let
    -- helper function to get the average of a list of Doubles
    -- uses List.genericLength to get the length of List as Double,
    -- instead of Int.
    average l =
      sum l / (List.genericLength l)

    -- make the list of bytestrings into tuple pairs
    -- so [a, b, c, d, ..] becomes [(a, b), (c, d), ..]
    -- pairs els =
    --   Split.splitEvery 2 els
    --   |> pairs'

    pairs els =
      case els of
        [] ->
          []
        a:[] ->
          []
        a:b:rest ->
          (a,b):(pairs rest)

    normalise d =
      (fromIntegral d) / (fromIntegral sz)

    -- create the pairs, feed them into the Hamming Function
    -- normalise per byte (or, more actually word8)
    -- and then compute the average
    averageDistance =
      pairs bss
      |> map Hamming.bytestrings  -- step 2: see Crypto.HammingDistance
      |> map normalise
      |> average
  in
    -- return the tuple of the size and the average distance
    (sz, averageDistance)
computeDistance sz bss =
  let
    -- helper function to get the average of a list of Doubles
    -- uses List.genericLength to get the length of List as Double,
    -- instead of Int.
    average l =
      sum l / (List.genericLength l)

    -- make the list of bytestrings into tuple pairs
    -- so [a, b, c, d, ..] becomes [(a, b), (c, d), ..]
    -- pairs els =
    --   Split.splitEvery 2 els
    --   |> pairs'

    pairs els =
      case els of
        [] ->
          []
        a:[] ->
          []
        a:b:rest ->
          (a,b):(pairs rest)

    normalise d =
      (fromIntegral d) / (fromIntegral sz)

    -- create the pairs, feed them into the Hamming Function
    -- normalise per byte (or, more actually word8)
    -- and then compute the average
    averageDistance =
      pairs bss
      |> map Hamming.bytestrings  -- step 2: see Crypto.HammingDistance
      |> map normalise
      |> average
  in
    -- return the tuple of the size and the average distance
    (sz, averageDistance)