F# Snippets

Recently added snippets

  • Install Fsx script as a windows service

    Just download nssm at http://www.nssm.cc/download then install the HttpEcho.fsx script as a service: nssm.exe install HttpEcho 'C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\FsiAnyCPU.exe' --exec c:/HttpEcho.fsx Now you're done. Off course you can install any fsx script as a service this way :D

    Posted: 10 days ago by thinkbeforecoding

  • Receive-only SMTP server

    An agent is used to act as SMTP server and receive emails. Another agent receives emails from the SMTP server and also responds to requests for all emails received. A type is exposed that wraps this behaviour in a single method to get the list of emails.

    Posted: 10 days ago by Nick Lydon

  • Chart NuGet package downloads

    Quick script using FsLab that visualizes the aggregate number of downloads of a NuGet package over time, using the HTML type provider to get the data from www.nuget.org.

    Posted: 11 days ago by Tomas Petricek

Popular snippets

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

    106 people like this
    Posted: 4 years ago by Blake Coverett

  • Adapter pattern

    Invoke the methods from incompatible types

    95 people like this
    Posted: 4 years ago by Tao Liu

  • WPF / SilverLight Converter II

    version 1 is http://fssnip.net/62. This new version support convert from any existing function to a converter function by using composition and pipeline. The convert function is to make the function signature agree to the IValueConverter interface. You can add new functions in the FunctionLibrary module and reuse the class definition to reduce the coding effort. The first sample is to show how to make the converter pipeline work, the second one is a debugger converter used to debug the data binding problem.

    83 people like this
    Posted: 4 years ago by Tao Liu

  • Top-Down-Operator-Precedence Parser

    F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper http://portal.acm.org/citation.cfm?id=512931 Example starts at line ~300

    82 people like this
    Posted: 4 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.

    89 people like this
    Posted: 4 years ago by Wolfgang Meyer

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

    115 people like this
    Posted: 4 years ago by Alex Muscar

Snippets by tags

tutorial (15) reflection (18) recursion (24) Kata (17) DSL (22) Sequence (29) Algorithms (25) tryfsharp (48) web (20) MailboxProcessor (24) Seq (46) agent (19) fold (16) sequences (44) SilverLight (21) Design Patterns (18) F# (41) string (17) math (30) Collections (16) List (46) game (29) monad (20) array (13) quotations (15) Learning F# (16) async (85) WPF (16) lazy (18) parsing (22)
View all..

Snippets by authors

View all..

Database contains 1787 snippets out of which 1309 are public.