Recent snippets

Popular snippets

  • The Haskell const function

    The const function is simple, but you can use it to make your code more legible. In this example we convert a unary function to a function of arity 2 (that ignores the second argument). Also by using the flip function from Haskell (which is equally easy to define) you can ignore the first argument.

    119 people like this

    Posted: 15 years ago by Alex Muscar

  • ObservableObject

    The ObservableObject type implements the INotifyPropertyChanged interface used in WPF and Silverlight to notify on changes to properties that are bound to a control. Specify property names type safely using F# Quotations, i.e. <@ this.PropertyName @> when invoking the NotifyPropertyChanged method. If you are following the MVVM pattern then your View Model class can inherit from the ObservableObject type.

    67 people like this

    Posted: 14 years ago by Phillip Trelford

  • Adapter pattern

    Invoke the methods from incompatible types

    110 people like this

    Posted: 14 years ago by Tao Liu

  • 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: 14 years ago by Tao Liu

  • ObservableObject

    The ObservableObject type implements the INotifyPropertyChanged interface used in WPF and Silverlight to notify on changes to properties that are bound to a control. Specify property names type safely using F# Quotations, i.e. <@ this.PropertyName @> when invoking the NotifyPropertyChanged method. If you are following the MVVM pattern then your View Model class can inherit from the ObservableObject type.

    67 people like this

    Posted: 14 years ago by Phillip Trelford

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

    83 people like this

    Posted: 14 years ago by Dmitri Pavlenkov

Snippets by tags

list (56) json (16) silverlight (22) seq (54) array (22) computation builder (17) web (29) tutorial (17) dsl (23) recursion (33) string (29) algorithms (26) html (16) learning f# (16) fold (22) pattern matching (15) game (32) f# (43) sequence (32) math (35)

View all...

Database contains 3207 snippets out of which 1719 is public.