F# Snippets

Recently added snippets

  • FoldBy Combinator

    Suggestion for a core library function.

    Posted: 4 days ago by Eirik Tsarpalis

  • Limit degree of parallelism using an agent

    The snippet implements a simple agent that limits the number of parallelism. When created, the agent takes the maximum number of tasks it can run in parallel. When it receives a "Start" message, it will then either run the task, or store it in a queue until earlier task ha completed.

    Posted: 4 days ago by Tomas Petricek

  • A Simple Parser

    This is a basic parser that I wrote which takes heavily from the examples in Dom Syme's Expert F# book and http://fsharpforfunandprofit.com/posts/pattern-matching-command-line/

    Posted: 10 days ago by Joe C

Popular snippets

  • Pipeline list processing

    An example showing how to process list in a pipeline. We first use List.filter to return only even numbers and then use List.map to format them as strings.

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

  • Adapter pattern

    Invoke the methods from incompatible types

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

  • 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

  • NUnit Sugar

    Some simple functions for writing more idiomatic F# tests with NUnit.

    76 people like this
    Posted: 3 years ago by Ryan Riley

  • Hello world (F#)

    Classical "Hello world" example that prints a message to the console output. This version uses F# printfn function to do the printing.

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

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

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

Snippets by tags

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

Snippets by authors

View all..

Database contains 1450 snippets out of which 1093 are public.