Recent snippets

Popular snippets

  • Break sequence into n-element subsequences

    I'm working on parallel computations and I thought it would be useful to break work into chunks, especially when processing each element asynchronously is too expensive. The neat thing is that this function is general even though motivation for it is specific. Another neat thing is that this is true lazy sequence unlike what you'd get if you used Seq.groupBy. There are three versions for your enjoyment.

    71 people like this

    Posted: 9 years ago by Dmitri Pavlenkov

  • Partition a sequence until a predicate is satiated

    This function is given a partition predicate and a sequence. Until the predicate returns false, a list will be filled with elements. When it is, both the list and the remainder of the sequence will be returned. Note that this example preserves the laziness of the unchecked sequence elements.

    68 people like this

    Posted: 9 years ago by Rick Minerich

  • A beautiful fixed-point finding function

    We start with an initial value and then applying f repeatedly, until the value does not change anymore.

    293 people like this

    Posted: 9 years ago by Nick Palladinos

Snippets by tags

web (26) reflection (18) list (53) seq (54) math (34) tutorial (17) pattern matching (14) wpf (20) learning f# (16) lists (14) dsl (23) monad (22) design patterns (18) regex (15) agent (20) fold (20) recursion (30) kata (17) computation builder (14) sequences (47)

View all...

Database contains 2379 snippets out of which 1616 is public.