Created
March 12, 2016 16:00
-
-
Save bleis-tift/3de7639f26543b466db0 to your computer and use it in GitHub Desktop.
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 | |
type Sound = Z | D | K | |
with | |
override this.ToString() = | |
match this with | |
| Z -> "ズン" | |
| D -> "ドコ" | |
| K -> "キ・ヨ・シ!" | |
let rnd = Random() | |
let genSound () = [|Z;D|].[rnd.Next(2)] | |
let rec loop x = function | |
| D::Z::Z::Z::Z::_ as xs -> printfn "%s" (string K) | |
| xs -> printf "%s" (string x); loop (genSound ()) (x::xs) | |
[<EntryPoint>] | |
let main _ = | |
loop (genSound ()) | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment