Recent snippets

  • Disposable Scopes provided by scope {...} computational workflow.

    This snippet provides a builder for scope {...} computational workflow that returns a Scope object implementing System.IDisposable interface. All "use" bindings inside scope {...} workflow are kept from being disposed immediately when computation leaves scope. Instead, they are disposed only when resulting Scope object is disposed. This makes possible to access disposable outside the scope while it remains usable. This can be achieved by via return statement of workflow that can return, for example, a closure that encapsulates disposable. scope {...} return value is available through Value property of Scope object. Scopes may be nested through let! binding that means that nested scope will be disposed when the resulting scope is disposed.

    2 people like this

    Posted: 1 month ago by Crazy Monk

  • StringBuilderCache.fs

    F# Impletementation of StringBuilderCache

    1 people like this

    Posted: 1 month ago by Pim

  • Rotate or shift lists

    This rotates or shifts a list. Unlike http://www.fssnip.net/qY/title/Rotate-List, which runs exponentially, this runs at O(n). In case of overflow (i.e., shift index is larger than the size of the list) will run at most once more with the modulo. This is done to prevent using `List.length` prior to entering the function, as that would lead to a perf punishment of an extra O(n) on each invocation. For large lists, `shift largeList 1` would then get a big performance hit.

    1 people like this

    Posted: 1 month ago by Abel Braaksma

Popular snippets

  • NUnit Sugar

    Some simple functions for writing more idiomatic F# tests with NUnit.

    88 people like this

    Posted: 11 years ago by Ryan Riley

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

    67 people like this

    Posted: 11 years ago by Tomas Petricek

  • Struct Tuple

    Two/Three/Four-element generic tuples implemented as a value types for writing more efficient F# code.

    59 people like this

    Posted: 11 years ago by fholm

Snippets by tags

dsl (23) game (32) fold (22) regex (16) fparsec (15) mailboxprocessor (27) pattern matching (15) html (15) design patterns (18) computation builder (16) silverlight (22) monad (23) learning f# (16) recursion (33) reflection (19) lists (14) string (27) sequence (32) lazy (20) json (14)

View all...

Database contains 3035 snippets out of which 1696 is public.