Recent snippets

Popular snippets

  • Filtering lists

    Two functions showing how to filter functional lists using the specified predicate. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter.

    77 people like this

    Posted: 15 years ago by Tomas Petricek

  • 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: 15 years ago by Novox

  • Hello world (F#)

    Classical "Hello world" example that prints a message to the console output. This version uses F# printfn function to do the printing.

    186 people like this

    Posted: 15 years ago by Tomas Petricek

Snippets by tags

f# (43) async (98) array (22) collections (16) learning f# (16) generic programming (17) json (16) design patterns (18) tryfsharp (48) tutorial (17) seq (54) regex (17) dsl (23) lazy (20) wpf (20) parsing (28) monad (24) pattern matching (15) game (32) math (35)

View all...

Database contains 3209 snippets out of which 1719 is public.