Recent snippets

Popular snippets

  • Partition a sequence until a predicate is satiated

    This function is given a partition predicate and a sequence. Until the predicate returns false, a list will be filled with elements. When it is, both the list and the remainder of the sequence will be returned. Note that this example preserves the laziness of the unchecked sequence elements.

    68 people like this

    Posted: 7 years ago by Rick Minerich

  • 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

  • Adapter pattern

    Invoke the methods from incompatible types

    101 people like this

    Posted: 7 years ago by Tao Liu

Snippets by tags

json (14) fold (19) mailboxprocessor (27) kata (17) learning f# (16) sequences (47) f# (42) http (15) array (20) dsl (22) html (15) tutorial (17) collections (16) monad (21) lists (13) staging (18) tryfsharp (48) list (50) math (32) fparsec (14)

View all...

Database contains 2270 snippets out of which 1546 is public.