Recent snippets

Popular snippets

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

    73 people like this

    Posted: 13 years ago by Dmitri Pavlenkov

  • Adapter pattern

    Invoke the methods from incompatible types

    110 people like this

    Posted: 12 years ago by Tao Liu

  • Read only ref

    F# implementation of RO_ref from the "Effective ML" talk.

    90 people like this

    Posted: 13 years ago by fholm

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

    75 people like this

    Posted: 13 years ago by Tomas Petricek

  • Implementing active objects with a MailboxProcessor

    Mailbox processors can easily be used to implement active objects. This example shows how to do that with a reusable wrapper type and minimal boilerplate code in the actual class definitions. Supports both asynchronous calls and synchronous calls. For the latter case, exceptions are automatically propagated back to the caller.

    92 people like this

    Posted: 13 years ago by Wolfgang Meyer

  • 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: 13 years ago by Ryan Riley

Snippets by tags

f# (43) async (98) array (22) computation builder (17) regex (17) html (15) learning f# (16) sequence (32) generic programming (17) silverlight (22) monad (24) math (35) tutorial (17) seq (54) dsl (23) mailboxprocessor (27) agent (20) wpf (20) design patterns (18) http (18)

View all...

Database contains 3190 snippets out of which 1710 is public.