Recent snippets

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.

    65 people like this

    Posted: 8 years ago by Tomas Petricek

  • Split a list

    Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.

    78 people like this

    Posted: 8 years ago by Dmitri Pavlenkov

  • Haskell function : iterate

    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.

    203 people like this

    Posted: 8 years ago by Nick Palladinos

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

    65 people like this

    Posted: 8 years ago by Tomas Petricek

  • Hello world (F#)

    Classical "Hello world" example that prints a message to the console output. This version uses F# printfn function to do the printing.

    179 people like this

    Posted: 8 years ago by Tomas Petricek

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

Snippets by tags

fparsec (15) reflection (18) sequences (47) web (24) generic programming (15) f# (42) lazy (19) staging (18) parsing (25) pattern matching (13) async (95) list (51) game (30) collections (16) monad (22) silverlight (22) kata (17) mailboxprocessor (27) recursion (30) array (21)

View all...

Database contains 2353 snippets out of which 1598 is public.