Monthly Archives: August 2014

2 Array functions in F# I can never remember

Array.sub

Builds a new array that contains the given subrange specified by starting index and length.

// Signature:
Array.sub : 'T [] -> int -> int -> 'T []

// Usage:
Array.sub array startIndex count

Array.blit

Reads a range of elements from the first array and writes them into the second.

// Signature:
Array.blit : 'T [] -> int -> 'T [] -> int -> int -> unit

// Usage:
Array.blit source sourceIndex target targetIndex count