Recent snippets

  • Request throttling agent

    Request throttling based on a time span and a request count. An `IDistributedCache` implementation is used which integrates nicely into ASP.NET Core. E.g. you can throttle requests from a specific IP address to allow fifty requests within a period of thirty seconds at most.

    3 people like this

    Posted: 1 month ago by toburger

  • F# Logging Module

    Self-contained module for scripting or small console programs.

    7 people like this

    Posted: 1 month ago by Pim Brouwers

  • Decrypting a Rijndael string

    This F# code decrypts an encrypted string using Rijndael symmetric encryption algorithm. It uses key and initialization vector stored in a registry key.

    2 people like this

    Posted: 2 months ago by Tuomas Hietanen

Popular snippets

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

    82 people like this

    Posted: 11 years ago by Novox

  • Partition a sequence until a predicate is satiated

    This function is given a partition predicate and a sequence. Until the predicate returns false, a list will be filled with elements. When it is, both the list and the remainder of the sequence will be returned. Note that this example preserves the laziness of the unchecked sequence elements.

    68 people like this

    Posted: 11 years ago by Rick Minerich

  • 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: 11 years ago by Tomas Petricek

  • Read only ref

    F# implementation of RO_ref from the "Effective ML" talk.

    82 people like this

    Posted: 11 years ago by fholm

  • 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

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

    87 people like this

    Posted: 10 years ago by Tao Liu

Snippets by tags

f# (44) fold (22) mailboxprocessor (27) wpf (20) quotations (21) array (22) silverlight (22) lazy (20) kata (17) computation builder (15) dsl (23) web (29) async (98) string (26) sequences (48) math (35) regex (16) fparsec (15) tutorial (17) design patterns (18)

View all...

Database contains 2948 snippets out of which 1690 is public.