Snippets tagged pipeline

  • Circular Buffer

    A Circular, or Ring, Buffer that flattens incoming arrays and allows consumers to take arbitrary-sized chunks. Improvements and suggestions welcome. Fork my gist at https://gist.github.com/1648579.

    7 people like this

    Posted: 12 years ago by Ryan Riley

  • Largest palindrome made from the product of two n-digit numbers

    A generalised version of the solution to the fourth Project Euler problem - Largest palindrome product, using sequences. The key to understanding this code is how "Seq.map (fun x -> (Seq.map (fun y -> x * y) baseSeq)) baseSeq" generates a sequence of sequences that contains the products of all possible combinations of two n-digit numbers. "Seq.map (fun x -> (Seq.map (fun y -> x * y) {1..3})) {1..3}" will generate: seq [seq [1; 2; 3]; seq [2; 4; 6]; seq [3; 6; 9]]

    3 people like this

    Posted: 11 years ago by Bjørn Bæverfjord