1 people like it.

BitArray to Sequence

Convert a BitArray to a sequence.

1: 
2: 
3: 
4: 
5: 
module Seq =
    open System.Collections
    let ofBitArray (bitArray:BitArray) = seq { 
        for i=0 to bitArray.Length-1 do yield bitArray.Get(i) 
    }
module Seq

from Microsoft.FSharp.Collections
namespace System
namespace System.Collections
val ofBitArray : bitArray:BitArray -> seq<bool>

Full name: Script.Seq.ofBitArray
val bitArray : BitArray
Multiple items
type BitArray =
  new : length:int -> BitArray + 5 overloads
  member And : value:BitArray -> BitArray
  member Clone : unit -> obj
  member CopyTo : array:Array * index:int -> unit
  member Count : int
  member Get : index:int -> bool
  member GetEnumerator : unit -> IEnumerator
  member IsReadOnly : bool
  member IsSynchronized : bool
  member Item : int -> bool with get, set
  ...

Full name: System.Collections.BitArray

--------------------
BitArray(length: int) : unit
BitArray(bytes: byte []) : unit
BitArray(values: bool []) : unit
BitArray(values: int []) : unit
BitArray(bits: BitArray) : unit
BitArray(length: int, defaultValue: bool) : unit
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
val i : int
property BitArray.Length: int
BitArray.Get(index: int) : bool

More information

Link:http://fssnip.net/kQ
Posted:10 years ago
Author:Samuel Bosch
Tags: seq , bitarray , sequences