Recent snippets

Popular snippets

  • Creating objects with events

    This snippet shows how to create objects with events in F#. It shows both simple event (to be used from F#) and a .NET compatible event with specific delegate type.

    77 people like this

    Posted: 8 years ago by Tomas Petricek

  • Asynchronous sequences

    An asynchronous sequence is similar to the seq type, but the elements of the sequence are generated asynchronously without blocking the caller as in Async. This snippet declares asynchronous sequence and uses it to compare two files in 1k blocks.

    107 people like this

    Posted: 8 years ago by Tomas Petricek

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

    203 people like this

    Posted: 8 years ago by Nick Palladinos

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

    117 people like this

    Posted: 8 years ago by Blake Coverett

  • Split a list

    Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.

    77 people like this

    Posted: 7 years ago by Dmitri Pavlenkov

  • Read only ref

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

    81 people like this

    Posted: 8 years ago by fholm

Snippets by tags

quotations (18) game (30) sequences (47) lists (13) collections (16) f# (42) mailboxprocessor (27) pattern matching (13) reflection (18) lazy (19) math (32) fold (19) dsl (22) parsing (23) web (24) learning f# (16) monad (22) sequence (30) fparsec (14) string (22)

View all...

Database contains 2288 snippets out of which 1557 is public.