Recently added snippets
Simple implementation of the popular game "2048". Can you add up the tiles and reach 2048? The game can be played in fsi or you can add the GUI which is so far missing.
Posted: 2 days ago by Tore Green
A generic numeral G. It allows writing functions for arbitrary numeric type. The transformation is an efficient one, because it is implemented explicitly for every type. It combines the type classes technique of FsControl (https://github.com/gmpl/FsControl and http://www.nut-cracker.com.ar/index.php/typeclasses-for-fsharp) with numeric literals. But FsControl is removed to completely avoid unnecessary function calls.
Posted: 5 days ago by Daniel Fabian (@iceypoi)
Check string of palindroms
Posted: 7 days ago by Zhukoff Dima
Prints a list in a spiral
Posted: 8 days ago by devshorts
Shuffling array using Seq.fold
Posted: 9 days ago by Karlkim Suwanmongkol
Demonstrates a possible encoding for GADTs in F#. It is type safe, uses no reflection and pattern matches can be declared outside of the definition itself. See also http://lambda-the-ultimate.org/node/1134
Posted: 10 days ago by Eirik Tsarpalis
F# implementation of RO_ref from the "Effective ML" talk.
79 people like this
Posted: 3 years ago by fholm
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.
93 people like this
Posted: 3 years ago by Blake Coverett
Implements iterate function from Haskell's Prelude. The function generates an infinite sequence by applying a function to the initial value (first) and then to the result of previous application.
153 people like this
Posted: 3 years ago by Nick Palladinos
Unlike the previous chain of responsibility, this version use the pipeline to chain responsibilities.
96 people like this
Posted: 2 years ago by Tao Liu
Learn Key Principle of F# in just a few minutes with the following Sample of "World Bank Type Provider - Exploring Population Data"
363 people like this
Posted: 3 months ago by Muhammad Mugees Asif
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.
81 people like this
Posted: 3 years ago by Neil Carrier
Snippets by tagsView all..
Snippets by authorsView all..
Database contains 1359 snippets out of which 1033 are public.