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.

    69 people like this

    Posted: 6 years ago by Dmitri Pavlenkov

  • The Haskell const function

    The const function is simple, but you can use it to make your code more legible. In this example we convert a unary function to a function of arity 2 (that ignores the second argument). Also by using the flip function from Haskell (which is equally easy to define) you can ignore the first argument.

    119 people like this

    Posted: 6 years ago by Alex Muscar

  • Read only ref

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

    81 people like this

    Posted: 6 years ago by fholm

  • Continuation-Passing Mnemonics

    Continuations provide a means whereby heap space can be traded for stack depth (heap space being generally more plentiful than stack depth). They are especially useful where tail recursion is not possible. Here are a couple of simple continuation examples that can be extended to cover more complex scenarios.

    88 people like this

    Posted: 6 years ago by Neil Carrier

  • Read only ref

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

    81 people like this

    Posted: 6 years ago by fholm

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

    90 people like this

    Posted: 6 years ago by Wolfgang Meyer

Snippets by tags

http (14) math (32) reflection (18) algorithms (25) string (17) pattern matching (12) collections (16) lists (13) html (14) fparsec (14) array (18) kata (17) regex (12) learning f# (16) monad (20) fold (19) lazy (18) xml (12) wpf (17) web (23)

View all...

Database contains 2114 snippets out of which 1458 is public.