Recent snippets

  • JsonValue JsonConverter

    Not super efficient, and doesn't work on every case, but works most of the time. Json.NET JsonConverter for a JsonValue, i.e. JsonValueConverter. If you're using with a converter for discriminated unions, be sure to give this one higher precedence (since JsonValue is implemented as a DU).

    1 people like this

    Posted: 1 month ago by Nat Elkins

  • Finding nearest airplane to a location

    Given a location as a float tuple (latitude, longitude) it will return the plane closest nearby as a JsonValue using the OpenSky API. For fun also demonstrating some operator overloading with (-->) between two coordinates. I'm new to these functional languages, so please feel free to update the solution with interesting refactortings and whatnot.

    3 people like this

    Posted: 2 months ago by Johan Irvall

  • MSMQ Functional Client

    F# Functional-style API for MSMQ, providing simple client operations like Send, Receive, and Peek.

    3 people like this

    Posted: 2 months ago by Aaron Eshbach

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.

    70 people like this

    Posted: 7 years ago by Dmitri Pavlenkov

  • Read only ref

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

    81 people like this

    Posted: 7 years ago by fholm

  • Factory Pattern

    Factory pattern in F#

    72 people like this

    Posted: 7 years ago by Tao Liu

  • 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: 7 years ago by Neil Carrier

  • Project Euler #1

    This snippet is code that solves first Project Euler problem. It finds the sum of all the multiples of 3 or 5 below 1000. Please add other (more efficient, succinct or interesting) solutions to this snippet.

    72 people like this

    Posted: 7 years ago by Eugene Gavrin

  • Pipeline list processing

    An example showing how to process list in a pipeline. We first use List.filter to return only even numbers and then use to format them as strings.

    88 people like this

    Posted: 7 years ago by Tomas Petricek

Snippets by tags

regex (14) fold (19) learning f# (16) tutorial (17) array (20) game (30) async (94) web (24) wpf (19) string (22) silverlight (21) list (50) computation builder (14) dsl (22) sequences (47) xml (12) f# (42) design patterns (18) tryfsharp (48) sequence (30)

View all...

Database contains 2252 snippets out of which 1537 is public.