Recent snippets

Popular snippets

  • Asynchronous sequences

    An asynchronous sequence is similar to the seq type, but the elements of the sequence are generated asynchronously without blocking the caller as in Async. This snippet declares asynchronous sequence and uses it to compare two files in 1k blocks.

    109 people like this

    Posted: 14 years ago by Tomas Petricek

  • 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.

    70 people like this

    Posted: 14 years ago by Rick Minerich

  • Creating objects with events

    This snippet shows how to create objects with events in F#. It shows both simple event (to be used from F#) and a .NET compatible event with specific delegate type.

    84 people like this

    Posted: 14 years ago by Tomas Petricek

  • Monadic Memoization

    Modular memoization within a pure functional setting that is implemented as a convenient computation builder.

    91 people like this

    Posted: 14 years ago by Nick Palladinos

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs (http://wcf.codeplex.com/). Composition is achieved through the use of the HttpRequestMessage -> Async signature. Pushing the app calls in the MessageHandler intercepts all requests and allows you to take control at the earliest point possible before operation selection occurs. Extending this slightly to call the innerChannel's SendAsync would allow you to create a middleware layer that would work both with this and other, normal Web API services.

    57 people like this

    Posted: 14 years ago by Ryan Riley

  • 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.

    83 people like this

    Posted: 14 years ago by Dmitri Pavlenkov

Snippets by tags

async (98) array (22) design patterns (18) http (18) dsl (23) math (35) collections (16) parsing (28) sequences (48) quotations (21) algorithms (26) silverlight (22) staging (18) recursion (33) f# (43) seq (54) reflection (19) tryfsharp (48) lazy (20) tutorial (17)

View all...

Database contains 3206 snippets out of which 1719 is public.