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.

    67 people like this

    Posted: 6 years ago by Rick Minerich

  • Split a list

    Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.

    75 people like this

    Posted: 6 years ago by Dmitri Pavlenkov

  • Active pattern for let binding inside patterns

    The Let active pattern demonstrated by this snippet can be used to assign values to symbols in pattern matching. This is useful for writing complex pattern matching using match as we can handle multiple cases using a single clause.

    64 people like this

    Posted: 6 years ago by Tomas Petricek

Snippets by tags

computation builder (13) quotations (17) xml (12) list (49) recursion (26) game (30) algorithms (25) sequence (29) dsl (22) http (14) seq (48) collections (16) design patterns (18) array (18) learning f# (16) reflection (18) regex (12) silverlight (21) lazy (18) pattern matching (12)

View all...

Database contains 2074 snippets out of which 1445 is public.