Earlier quoted context omitted.
This looks magical :-) Are you sure you're decoding bits from an octet stream (normal 8-bit bytes) and not using logical booleans? I ask this because I don't see any bit-manipulation operators, except maybe for "1 :> 'T" which looks like the SML module type casting, but I could be wrong.
Yes very sure. nthbit will extract the nth bit from an integer type. The bitwise logic is the &&& and http://msdn.microsoft.com/en-us/library/dd469495.aspx bitstream turns a sequence of integer types into a sequence of bits. So if you wanted to turn a stream into bits you'd do something like the following. new System.IO.FileStream('foo.txt') |> Seq.unfold (fun s -> (s , match s.read with | -1 -> None | x -> Some(x)))…
let bitsToBitContainer (s:seq) : seq =
let sz = sizeof*8
s
|> Seq.scan (fun (i,n) x -> (i++,(n Seq.filter (fun (i,n) -> i = sz)
|> Seq.map (fun (i,n) -> n)