Recent snippets

Popular snippets

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

    124 people like this

    Posted: 14 years ago by Blake Coverett

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

    87 people like this

    Posted: 14 years ago by Novox

  • Projecting lists

    Three functions showing how to implement projection for functional lists. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter. The third version extends this with continuation passing.

    74 people like this

    Posted: 14 years ago by Tomas Petricek

Snippets by tags

wpf (20) sequence (32) collections (16) computation builder (17) staging (18) tryfsharp (48) seq (54) json (16) lazy (20) learning f# (16) http (18) algorithms (26) computation expression (15) silverlight (22) pattern matching (15) array (22) regex (17) agent (20) lists (15) quotations (21)

View all...

Database contains 3205 snippets out of which 1719 is public.