Recent snippets

Popular snippets

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

    119 people like this

    Posted: 8 years ago by Alex Muscar

  • Doughnut chart using chart controls

    The snippet shows how to use Microsoft Chart Controls (available in .NET 4.0 and for .NET 3.5) to draw a Doughnut chart. The sample shows proportion of seats taken by parties in UK elections.

    85 people like this

    Posted: 8 years ago by Tomas Petricek

  • NUnit Sugar

    Some simple functions for writing more idiomatic F# tests with NUnit.

    86 people like this

    Posted: 8 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

    86 people like this

    Posted: 8 years ago by fholm

  • 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: 7 years ago by Tao Liu

  • Composing a list of functions

    Composition of functions in F# is easily achieved by using the >> operator. You can also chain an arbitary amount of functions (represented as a list or sequence) together by folding the list/seq with >>. [More formally: the set of endomorphisms 'a -> 'a forms a monoid with the binary, associative operator ">>" (or "<<") and the neutral element "id".]

    79 people like this

    Posted: 8 years ago by Novox

Snippets by tags

math (32) array (20) string (22) learning f# (16) kata (17) staging (18) html (15) list (51) f# (42) sequence (30) async (95) fold (19) quotations (18) seq (52) fparsec (15) lazy (19) parsing (25) algorithms (25) collections (16) silverlight (22)

View all...

Database contains 2340 snippets out of which 1589 is public.