F# Snippets

Recently added snippets

  • 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: 3 hours 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: 8 days ago by Tomas Petricek

  • CostStudy.fsx

    Simple Cost Study

    Posted: 11 days ago by NicolasDobler

  • Generating numerical ranges

    Different ways of generating numerical ranges in F#. It turns out that the built-in syntax generates fairly slow code, so the snippet shows two alternative ways that are faster. Any compiler optimizations making the built-in one faster would be nice :-)

    Posted: 16 days ago by Tomas Petricek

  • Easy use of IDisposable

    A fun little trick.

    Posted: 20 days ago by BR

  • HttpUtils

    Forgotten file for F# Works |> Paris!!!

    Posted: 25 days ago by Tomas Petricek

Popular snippets

  • Exploring Population Data

    Learn Key Principle of F# in just a few minutes with the following Sample of "World Bank Type Provider - Exploring Population Data"

    365 people like this
    Posted: 6 months ago by Muhammad Mugees Asif

  • A beautiful fixed-point finding function

    We start with an initial value and then applying f repeatedly, until the value does not change anymore.

    243 people like this
    Posted: 3 years ago by Nick Palladinos

  • The Haskell const function

    The const function is simple, but you can use it to make your code more legible. In this example we convert a unary function to a function of arity 2 (that ignores the second argument). Also by using the flip function from Haskell (which is equally easy to define) you can ignore the first argument.

    99 people like this
    Posted: 3 years ago by Alex Muscar

  • 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

  • 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

  • Minimal XML DSL

    This snippet provides a very small internal DSL for creating and querying XML using the underlying XLinq classes.

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

Snippets by tags

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

Snippets by authors

View all..

Database contains 1419 snippets out of which 1070 are public.