Recent snippets

Popular snippets

  • Factory Pattern

    Factory pattern in F#

    82 people like this

    Posted: 15 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".]

    87 people like this

    Posted: 15 years ago by Novox

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

Snippets by tags

generic programming (17) design patterns (18) game (32) sequence (32) array (22) sequences (48) f# (43) math (35) computation expression (15) recursion (33) lazy (20) staging (18) list (56) fold (22) reflection (19) wpf (20) pattern matching (15) learning f# (16) async (98) agent (20)

View all...

Database contains 3209 snippets out of which 1719 is public.