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: 13 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.

    373 people like this

    Posted: 13 years ago by Blake Coverett

  • FSX Structure

    I use this basic template when writing .fsx files that I might want to compile. It adjusts the difference in command line/entrypoint handling between a script and a compiled assembly. This example shows the details for a WPF script — replace the #r's and/or remove the STAThread for a WinForms or Console script.

    122 people like this

    Posted: 13 years ago by Blake Coverett

  • Break sequence into n-element subsequences

    I'm working on parallel computations and I thought it would be useful to break work into chunks, especially when processing each element asynchronously is too expensive. The neat thing is that this function is general even though motivation for it is specific. Another neat thing is that this is true lazy sequence unlike what you'd get if you used Seq.groupBy. There are three versions for your enjoyment.

    72 people like this

    Posted: 13 years ago by Dmitri Pavlenkov

  • Association list lookup

    While prototyping programs I find myself using association lists. This little snippet defines a lookup functions for association lists defined as lists of tuples.

    68 people like this

    Posted: 13 years ago by Alex Muscar

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs ( 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.

    56 people like this

    Posted: 13 years ago by Ryan Riley

Snippets by tags

sequences (48) tryfsharp (48) generic programming (17) pattern matching (15) collections (16) design patterns (18) wpf (20) json (15) http (18) computation builder (17) seq (54) dsl (23) list (56) quotations (21) kata (17) silverlight (22) recursion (33) mailboxprocessor (27) tutorial (17) game (32)

View all...

Database contains 3185 snippets out of which 1709 is public.