Recent snippets

Popular snippets

  • Projecting lists

    Three functions showing how to implement projection for functional lists. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter. The third version extends this with continuation passing.

    74 people like this

    Posted: 14 years ago by Tomas Petricek

  • Minimal XML DSL

    This snippet provides a very small internal DSL for creating and querying XML using the underlying XLinq classes.

    374 people like this

    Posted: 14 years ago by Blake Coverett

  • Filtering lists

    Two functions showing how to filter functional lists using the specified predicate. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter.

    77 people like this

    Posted: 14 years ago by Tomas Petricek

  • 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

  • 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: 14 years ago by Novox

  • A beautiful fixed-point finding function

    We start with an initial value and then applying f repeatedly, until the value does not change anymore.

    302 people like this

    Posted: 14 years ago by Nick Palladinos

Snippets by tags

tutorial (17) fold (22) regex (17) http (18) game (32) kata (17) sequences (48) pattern matching (15) list (56) recursion (33) async (98) design patterns (18) array (22) monad (24) mailboxprocessor (27) parsing (28) html (16) f# (43) math (35) collections (16)

View all...

Database contains 3203 snippets out of which 1717 is public.