Recent snippets

  • Optimal Cloud Coloring & famous 4 color map

    Four colors will print a map so adjacent states have different color. F# has clear concise code. Map has a list of pairs sharing a border. Incremental improvements in the code can be less use of key word 'function'. Since syntax is not ambiguous can it be fixed in the compiler? so '=function |' changes to '=|' ? Welcome to improve. Harrop,Mathias,Jack,Art,HR,fwaris,Don Syme, sffs... Thanks! Musa.Jahanghir@Live.com AVCLive1.com

    6 people like this

    Posted: 25 days ago by Musa Jahanghir

  • tutorial, test, tennis, clarity, simplicity in f#

    f# short and sweet may help beginners. Score on winning a point, Winning number first and other players is labeled: b example "0",b ->"15", b. A special case of draw-deuce is "40", "A" -> "40","40" If player 2 wins a point score calling is flipped as 2->score(b,a). fold (fun to call for each element in the test list) (initials "0","0") [test list of winning player] Notice f# is perhaps easier and clearer than pseudo code and verbose description. An improvement suggestion for Don is if syntax is not confused can word function be made optional so = |... or -> |.. so syntax is ever more clearer?

    7 people like this

    Posted: 25 days ago by Musa Jahanghir

  • The Eff monad

    The Eff monad in F#, based on http://okmij.org/ftp/Computation/free-monad.html.

    1 people like this

    Posted: 28 days ago by NIck Palladinos

Popular snippets

  • Units of Measure

    Show's how to define units of measure to add stronger typing to your numerical functions.

    73 people like this

    Posted: 6 years ago by Robert Pickering

  • Dynamic operator using Reflection

    Demonstrates how to implement the dynamic operator (?) using .NET Reflection. The implementation supports calling constructors, propreties and methods using simple overload resolution (based on parameter count). It handles instance as well as static members.

    62 people like this

    Posted: 6 years ago by Tomas Petricek

  • Projecting lists

    Three functions showing how to implement projection for functional lists. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter. The third version extends this with continuation passing.

    63 people like this

    Posted: 6 years ago by Tomas Petricek

  • Adapter pattern

    Invoke the methods from incompatible types

    97 people like this

    Posted: 6 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: 6 years ago by Tao Liu

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

    115 people like this

    Posted: 6 years ago by Blake Coverett

Snippets by tags

quotations (17) regex (12) xml (12) http (14) algorithms (25) dsl (22) wpf (18) html (14) tryfsharp (48) reflection (18) computation builder (14) list (49) web (23) lazy (18) agent (20) recursion (26) array (18) seq (50) silverlight (21) staging (18)

View all...

Database contains 2169 snippets out of which 1493 is public.