Recent snippets

Popular snippets

  • Split a list

    Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.

    78 people like this

    Posted: 8 years ago by Dmitri Pavlenkov

  • Doughnut chart using chart controls

    The snippet shows how to use Microsoft Chart Controls (available in .NET 4.0 and for .NET 3.5) to draw a Doughnut chart. The sample shows proportion of seats taken by parties in UK elections.

    85 people like this

    Posted: 8 years ago by Tomas Petricek

  • Implementing active objects with a MailboxProcessor

    Mailbox processors can easily be used to implement active objects. This example shows how to do that with a reusable wrapper type and minimal boilerplate code in the actual class definitions. Supports both asynchronous calls and synchronous calls. For the latter case, exceptions are automatically propagated back to the caller.

    90 people like this

    Posted: 8 years ago by Wolfgang Meyer

  • Composing a list of functions

    Composition of functions in F# is easily achieved by using the >> operator. You can also chain an arbitary amount of functions (represented as a list or sequence) together by folding the list/seq with >>. [More formally: the set of endomorphisms 'a -> 'a forms a monoid with the binary, associative operator ">>" (or "<<") and the neutral element "id".]

    79 people like this

    Posted: 8 years ago by Novox

  • Monadic Memoization

    Modular memoization within a pure functional setting that is implemented as a convenient computation builder.

    88 people like this

    Posted: 8 years ago by Nick Palladinos

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

    65 people like this

    Posted: 8 years ago by Tomas Petricek

Snippets by tags

reflection (18) wpf (20) web (24) silverlight (22) agent (20) staging (18) list (52) string (22) tryfsharp (48) async (95) array (21) lazy (19) json (14) generic programming (16) http (15) f# (42) sequence (30) lists (14) kata (17) computation builder (14)

View all...

Database contains 2359 snippets out of which 1603 is public.