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: 26 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: 26 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: 1 months ago by NIck Palladinos

Popular snippets

  • 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

  • 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

  • Chain of responsibility II

    Unlike the previous chain of responsibility, this version use the pipeline to chain responsibilities.

    98 people like this

    Posted: 6 years ago by Tao Liu

Snippets by tags

xml (12) regex (12) algorithms (25) pattern matching (12) kata (17) recursion (26) agent (20) seq (50) sequences (47) string (18) array (18) sequence (29) list (49) math (32) fparsec (14) json (12) fold (19) game (30) learning f# (16) lists (13)

View all...

Database contains 2169 snippets out of which 1493 is public.