Snippets created by Robert Pickering
'use' Bindings
Show's how to use F# 'use' key word to dispose a resource when it passes out of scope.
24 people like this
Posted: 1 years ago by Robert PickeringUnfolding Sequences
Demonstrates how to use unfold to create an infinite list of the fibonacci numbers
39 people like this
Posted: 1 years ago by Robert PickeringUsing the 'lazy' Keyword
This snippet uses the lazy keyword to create a delayed computation. It then show's using 'force' to evaluate the computation.
23 people like this
Posted: 1 years ago by Robert PickeringUsing the 'lazy' Keyword
Demonstrates using the 'lazy' keyword. Show's how a lazy value will only ever be evaluated once.
42 people like this
Posted: 1 years ago by Robert PickeringUnfolding Sequences
Show's using the unfold function to create a sequence that terminates once some limit is passed.
25 people like this
Posted: 1 years ago by Robert Pickering
Recursive functions
Show's how to define a recursive function that will calculate a fibonacci number.
9 people like this
Posted: 1 years ago by Robert PickeringUsing Active patterns
Shows how to use an active pattern that will try to determine the format of an input value.
10 people like this
Posted: 1 years ago by Robert PickeringUsing Active patterns
Show's how to create a parametrized active pattern that will match based on a regular expression.
15 people like this
Posted: 1 years ago by Robert PickeringUnits of Measure
Show's how to define units of measure to add stronger typing to your numerical functions.
52 people like this
Posted: 1 years ago by Robert PickeringCalculating when the 1000th XKCD will appear
Calculate's when a the nth XKCD will appear, starting from XKCD 946. For a full explanation this snippet see: http://strangelights.com/blog/archive/2011/09/02/calculating-when-the-1000th-xkcd-will-appear.aspx
2 people like this
Posted: 8 months ago by Robert Pickering