F# Snippets

Recently added snippets

  • Game of 2048

    Simple implementation of the popular game "2048". Can you add up the tiles and reach 2048? The game can be played in fsi or you can add the GUI which is so far missing.

    Posted: 2 days ago by Tore Green

  • Generic number literal

    A generic numeral G. It allows writing functions for arbitrary numeric type. The transformation is an efficient one, because it is implemented explicitly for every type. It combines the type classes technique of FsControl (https://github.com/gmpl/FsControl and http://www.nut-cracker.com.ar/index.php/typeclasses-for-fsharp) with numeric literals. But FsControl is removed to completely avoid unnecessary function calls.

    Posted: 5 days ago by Daniel Fabian (@iceypoi)

  • Palindrom

    Check string of palindroms

    Posted: 7 days ago by Zhukoff Dima

Popular snippets

  • Read only ref

    F# implementation of RO_ref from the "Effective ML" talk.

    79 people like this
    Posted: 3 years ago by fholm

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

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

  • Haskell function : iterate

    Implements iterate function from Haskell's Prelude. The function generates an infinite sequence by applying a function to the initial value (first) and then to the result of previous application.

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

  • Chain of responsibility II

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

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

    363 people like this
    Posted: 3 months ago by Muhammad Mugees Asif

  • 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

Snippets by tags

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

Snippets by authors

View all..

Database contains 1359 snippets out of which 1033 are public.