This file contains hidden or 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
module type OrderedType = sig | |
type t | |
val compare : t -> t -> int | |
end | |
module type S = | |
sig | |
type elt | |
type t | |
val empty: t |
This file contains hidden or 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 fizz = | |
Seq.initInfinite (fun i -> if (i+1) % 3 = 0 then "Fizz" else "") | |
let buzz = | |
Seq.initInfinite (fun i -> if (i+1) % 5 = 0 then "Buzz" else "") | |
let fizzbuzz = | |
Seq.mapi2 (fun i f b -> match f + b with "" -> string (i + 1) | x -> x) fizz buzz | |
fizzbuzz | |
|> Seq.take 100 | |
|> Seq.iter (printfn "%s") |
This file contains hidden or 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
// https://twitter.com/e869120/status/1741475801026204116# | |
(* | |
(20 + (((23 + 12) - 31) * ((20 * (24 + 1)) + 1))) | |
(((20 * 23) + (((12 + 31) - 20) * 24)) * (1 + 1)) | |
*) | |
let rec gcd a (b: int) = if b = 0 then a else gcd b (a % b) |
OlderNewer