This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
let diamond char = | |
let chars = [ 'A' .. char ] | |
let numberOfChars = List.length chars | |
let padCount i = numberOfChars - (i + 1) | |
let gridWidth = numberOfChars * 2 - 1 | |
let pad i = new string (' ', i) | |
let init = chars |> List.mapi (fun i c -> (string c), (padCount i)) | |
let all = init @ (List.tail (List.rev init)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ShortCode = private ShortCode of string | |
type ProductShortCode = private ProductShortCode of ShortCode | |
type AccountShortCode = private AccountShortCode of ShortCode | |
module ShortCode = | |
let create s = | |
if System.String.IsNullOrEmpty s then None | |
elif s.Length > 15 then None | |
else Some (ShortCode s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let vals = [(1000, "M");(900, "CM");(500, "D");(400, "CD"); | |
(100, "C");(90, "XC");(50, "L");(40, "XL"); | |
(10, "X");(9,"IX");(5,"V");(4,"IV");(1, "I")] | |
let toRoman iVal = | |
let rec loop acc n list = | |
match list with | |
| [] -> acc | |
| (i, s)::xs when n >= i -> loop (acc + s) (n - i) list | |
| x::xs -> loop acc n xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Data | |
open System.Data.SqlClient | |
let bigGrossQuery = "SELECT c.id, c.accountName | |
FROM dbo.accounts AS c | |
WHERE c.accountName IN | |
( << A GIGANTIC LIST OF ACCOUNTS >> );" | |
let connectionString = "Server=myserver.redacted.org; |
NewerOlder