F# Snippets

Recently added snippets

Popular snippets

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

    79 people like this
    Posted: 3 years ago by Wolfgang Meyer

  • WPF / SilverLight Converter II

    version 1 is http://fssnip.net/62. This new version support convert from any existing function to a converter function by using composition and pipeline. The convert function is to make the function signature agree to the IValueConverter interface. You can add new functions in the FunctionLibrary module and reuse the class definition to reduce the coding effort. The first sample is to show how to make the converter pipeline work, the second one is a debugger converter used to debug the data binding problem.

    83 people like this
    Posted: 3 years ago by Tao Liu

  • FSX Structure

    I use this basic template when writing .fsx files that I might want to compile. It adjusts the difference in command line/entrypoint handling between a script and a compiled assembly. This example shows the details for a WPF script — replace the #r's and/or remove the STAThread for a WinForms or Console script.

    94 people like this
    Posted: 3 years ago by Blake Coverett

  • Asynchronous sequences

    An asynchronous sequence is similar to the seq<T> type, but the elements of the sequence are generated asynchronously without blocking the caller as in Async<T>. This snippet declares asynchronous sequence and uses it to compare two files in 1k blocks.

    78 people like this
    Posted: 3 years ago by Tomas Petricek

  • Chain of responsibility II

    Unlike the previous chain of responsibility, this version use the pipeline to chain responsibilities.

    97 people like this
    Posted: 3 years ago by Tao Liu

  • Adapter pattern

    Invoke the methods from incompatible types

    94 people like this
    Posted: 3 years ago by Tao Liu

Snippets by tags

lazy (17) string (15) Learning F# (15) Kata (16) DSL (21) SilverLight (21) F# (33) Algorithms (21) reflection (18) recursion (24) WPF (15) async (68) game (22) computation builder (13) MailboxProcessor (21) Design Patterns (18) agent (17) math (28) collections (13) parsing (21) lists (13) fold (13) list (40) Sequence (28) tutorial (15) tryfsharp (41) sequences (43) monad (18) Seq (42) web (15)
View all..

Snippets by authors

View all..

Database contains 1471 snippets out of which 1106 are public.