Intro I am learning F# and am logging my progress or lack of. In doing so, I attempted a Kata for implementing a string calculator. I did steps 1-4 of the exercise. I then got bored and decided to look for other katas. The following code was generated to satisfy the guts of the kata: …
F#: Railway-Oriented Programming
Intro Documenting interpretation of Railway-Oriented Programming. The "Railway" provides a "Success Track" and a "Failure Track". The Success Track is defined as the track of the "Happy Path". This means that the objective of a function was completed successfully without errors. There also exists an alternate track that isn't exposed initially. This track is known as the Failure Track. The …
Learning F# – BlackJack
This source code will serve as a reference for common set operations that have been partially implemented for a BlackJack game. Feedback is welcomed within the comments section as I continue learning this mythical language. module Core type Suit = | Spades | Clubs | Diamonds | Hearts type Face = | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace type Card = {Face:Face; Suit:Suit} type Deal = | Hand of Card * Card | Hit of Card let private suits = [Spades; Clubs; Diamonds ; Hearts] let private faces = [Two; Three; Four; Five; Six; Seven; Eight; Nine; Ten; Jack; Queen; King; Ace] let deck = [for suit in suits do for face in faces do yield {Face=face; Suit=suit}] let hitPlayer (deck:Card list) = (deck.Head, deck.Tail) let deal = function | card1::card2::remaining -> Some(card1, card2), remaining …
10 Commandments for Unit Testing
Ten Commandments for Unit Testing Refactor SUT to limit LOC required to setup a unit test Limit a unit test to 10 LOC or less Engineer tests so that they fail because of business logic and not setup logic Test behaviors and NOT implementation details Unit test business logic and NOT integration concerns Control test …
MVVM with F# (Tutorial)
Intro I have reason to believe that F# will be the language of choice in several years for the .NET platform. This language was designed to assist error-prone developers such as myself from making mistakes that stem from having to write too many lines of code for expressing how a moderate operation is to execute. …
F# Code Snippets?
Did you know that you can leverage Code Snippets in F#? Big shoutout to Tao Liu for providing this support. Here's a summary of how to leverage this awesome productivity tool: Download the F# Snippets Extension. Download the code snippet files here. Select Tools | Code Snippets Manager. Ensure the following path exists:C:\Users\<username>\Documents\Visual Studio 2015\Code Snippets\Visual …
F# Constructs (Brain Dump)
Objective Generate a Tic-Tac-Toe grid and provide a function to identify if all rows match a particular pattern. First let’s generate a Tic-Tac-Toe grid:let grid = [ for i in 0..8 -> (i, true) ] |> Map.ofSeqSo what’s happening here? We declare a value called grid that by default is immutable: let grid = … …