Recent snippets

Popular snippets

  • Break sequence into n-element subsequences

    I'm working on parallel computations and I thought it would be useful to break work into chunks, especially when processing each element asynchronously is too expensive. The neat thing is that this function is general even though motivation for it is specific. Another neat thing is that this is true lazy sequence unlike what you'd get if you used Seq.groupBy. There are three versions for your enjoyment.

    73 people like this

    Posted: 15 years ago by Dmitri Pavlenkov

  • Chain of responsibility

    The following sample wants to make sure the person’s age is between 18 and 65, weight is no more than 200 and tall enough (>120).

    85 people like this

    Posted: 15 years ago by Tao Liu

  • Command pattern for Redo-Undo II

    This command redo-undo implement group the command under Do/Undo category.

    71 people like this

    Posted: 15 years ago by Tao Liu

  • 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: 15 years ago by Nick Palladinos

  • Strategy pattern

    Strategy pattern in F#

    83 people like this

    Posted: 15 years ago by Tao Liu

  • Composing a list of functions

    Composition of functions in F# is easily achieved by using the >> operator. You can also chain an arbitary amount of functions (represented as a list or sequence) together by folding the list/seq with >>. [More formally: the set of endomorphisms 'a -> 'a forms a monoid with the binary, associative operator ">>" (or "<<") and the neutral element "id".]

    87 people like this

    Posted: 15 years ago by Novox

Snippets by tags

regex (17) silverlight (22) generic programming (17) mailboxprocessor (27) f# (43) sequence (32) kata (17) seq (54) fold (22) math (35) learning f# (16) html (16) algorithms (25) dsl (23) tryfsharp (48) web (29) monad (24) recursion (33) pattern matching (15) agent (20)

View all...

Database contains 3209 snippets out of which 1719 is public.