What is it?
You can write posts in Firm in literate programming style. What that means is that instead of writing documents in markdown text and specifically format the parts that contain code, you turn it around and make code your main content and embed text as comments. The major upside of this is that the source of your post or page is an fsharp script file (.fsx) that can be run in e.g. Visual Studio.
Made possible by
The fsharp script file is fed to FSharp.Formatting, which does all the heavy lifting.
First the range.
let range = [0..999]
Then the predicate that checks for multiples of 3 or 5.
let condition x = x % 3 = 0 || x % 5 = 0
And finally the function that runs the above declared predicate on the range and sums it up using built in library functions.
1: 2: 3:
range |> List.filter condition |> List.fold (+) 0
You can find an example that covers pretty much all features on the FSharp.Formatting documentation site.
You can check the source of this blog post to see the actual script.
Full name: Index.range
Full name: Index.condition
type List<'T> =
| (  )
| ( :: ) of Head: 'T * Tail: 'T list
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
static member Cons : head:'T * tail:'T list -> 'T list
static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
Full name: Microsoft.FSharp.Collections.List.filter
Full name: Microsoft.FSharp.Collections.List.fold