F# Snippets

Recently added snippets

  • Duck Typed Dereferencing!

    Make the (!) operator even more useful by duck typing it. Simple and effective!

    Posted: 11 days ago by Sami Perttu

  • divide me.fsx

    This script finds all possible divisors of a number

    Posted: 12 days ago by Knerd

  • Get entity names from Freebase type provider

    This sample uses the internals of the Freebase type provider to get the names of all the entities that Freebase knows about. The snippet returns the type names, so some of the type provider internals are exposed, but it still returns nice list of entities.

    Posted: 15 days ago by Tomas Petricek

Popular snippets

  • Monadic Memoization

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

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

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

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

  • 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

  • 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

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

    367 people like this
    Posted: 7 months ago by Muhammad Mugees Asif

  • Adapter pattern

    Invoke the methods from incompatible types

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

Snippets by tags

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

Snippets by authors

View all..

Database contains 1436 snippets out of which 1083 are public.