Recent snippets

Popular snippets

  • Factory Pattern

    Factory pattern in F#

    73 people like this

    Posted: 7 years ago by Tao Liu

  • 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

  • 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

kata (17) math (32) fold (19) tutorial (17) string (22) web (24) dsl (22) sequences (47) async (95) learning f# (16) computation builder (14) mailboxprocessor (27) regex (15) wpf (20) pattern matching (13) array (20) parsing (25) algorithms (25) collections (16) agent (20)

View all...

Database contains 2294 snippets out of which 1563 is public.