F# Snippets

Recently added snippets

  • Reading binary values from a file

    Small F# snippet on how to read 32-bit integers from a file at specific indexes.

    Posted: 7 days ago by Samuel Bosch

  • Binomial probabilities

    Simple function for commute binomial probabilities. For quick summary about binomial distribution: 1.) There are a fixed number of trials (n). 2.) Each trial has two possible outcomes: success of failure 3.) The probability of success (p) is the same for each trial. 4.) The trials are independent, meaning the outcome of one trial doesn't influence that of any other.

    Posted: 7 days ago by Martin Bodocky

  • Split a list using a separator

    Split a list into chunks using the specified separator. This takes a list and returns a list of lists (chunks) that represent individual groups, separated by the given separator 'v'

    Posted: 15 days ago by Tomas Petricek

Popular snippets

  • Chain of responsibility II

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

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

  • 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: 2 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

  • Top-Down-Operator-Precedence Parser

    F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper http://portal.acm.org/citation.cfm?id=512931 Example starts at line ~300

    80 people like this
    Posted: 3 years ago by fholm

  • Continuation-Passing Mnemonics

    Continuations provide a means whereby heap space can be traded for stack depth (heap space being generally more plentiful than stack depth). They are especially useful where tail recursion is not possible. Here are a couple of simple continuation examples that can be extended to cover more complex scenarios.

    81 people like this
    Posted: 3 years ago by Neil Carrier

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

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

Snippets by tags

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

Snippets by authors

View all..

Database contains 1423 snippets out of which 1074 are public.