Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type SomeClass(thesize, bytestream : seq<byte>) = class
- let mutable myarray_ = Array.create<byte> thesize 0uy
- do
- let mutable idx = 0
- for v in bytestream do
- myarray_.[idx] <- v
- idx <- idx + 1
- member x.Func(index) = // consumes myarray_.[index] and neighbor values
- type OuterClass(thesize, bytestream) = class
- member x.cp : SomeClass = new SomeClass(thesize, bytestream)
- member x.Func(index) =
- x.cp.Func(index)
- type SomeClass(thesize, bytestream : seq<byte>) =
- let myarray_ = [| yield! bytestream
- for i in (Seq.length bytestream)..(thesize-1) -> 0uy |]
- ....
- member x.cp : SomeClass = new SomeClass(thesize, bytestream)
- type OuterClass(thesize, bytestream) =
- let cp = new SomeClass(thesize, bytestream)
- member x.cp = cp
- type SomeClass(size, bytes : seq<byte>) =
- let buf = Array.zeroCreate size
- do
- // Here code assumes that size is always greater than number of items in bytes, is it always correct ?
- Seq.iteri(fun i b -> buf.[i] <- b) bytes
- member this.Buffer = buf
- let v = SomeClass(5, (List.init 3 byte))
- printfn "%A" v.Buffer // printf [|0uy; 1uy; 2uy; 0uy; 0uy|]
Add Comment
Please, Sign In to add comment