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
var sSimilarity = function(sa1, sa2){ | |
// Compare two strings to see how similar they are. | |
// Answer is returned as a value from 0 - 1 | |
// 1 indicates a perfect similarity (100%) while 0 indicates no similarity (0%) | |
// Algorithm is set up to closely mimic the mathematical formula from | |
// the article describing the algorithm, for clarity. | |
// Algorithm source site: http://www.catalysoft.com/articles/StrikeAMatch.html | |
// (Most specifically the slightly cryptic variable names were written as such | |
// to mirror the mathematical implementation on the source site) | |
// |
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 FizzBuzz = | |
| Fizzy of int | |
| Buzzy of int | |
| FizzBuzzy of int | |
| NormalNumber of int | |
let fizzBuzz x = | |
match x with | |
| x when (x % 15) = 0 -> FizzBuzzy(x) | |
| x when (x % 5) = 0 -> Buzzy(x) |