Recent snippets

Popular snippets

  • 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.

    67 people like this

    Posted: 5 years ago by Rick Minerich

  • Project Euler #1

    This snippet is code that solves first Project Euler problem. It finds the sum of all the multiples of 3 or 5 below 1000. Please add other (more efficient, succinct or interesting) solutions to this snippet.

    70 people like this

    Posted: 5 years ago by Eugene Gavrin

  • Factory Pattern

    Factory pattern in F#

    68 people like this

    Posted: 4 years ago by Tao Liu

  • 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.

    68 people like this

    Posted: 5 years ago by Dmitri Pavlenkov

  • Filtering lists

    Two functions showing how to filter functional lists using the specified predicate. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter.

    62 people like this

    Posted: 5 years ago by Tomas Petricek

  • Read only ref

    F# implementation of RO_ref from the "Effective ML" talk.

    80 people like this

    Posted: 5 years ago by fholm

Snippets by tags

Ninety-Nine F# Problems (11) computation builder (13) pattern matching (11) Async (16) F# (36) asynchronous (9) lazy (10) Game (16) game (14) agent (17) Sequence (10) async (70) WPF (15) Sequences (22) Kata (12) tryfsharp (48) string (14) math (28) tutorial (15) parsing (17)

View all...

Database contains 2355 snippets out of which 1329 is public.