2016-03-01から1ヶ月間の記事一覧
let zundokoSeq = seq{ let rand = new System.Random () while true do let x = rand.Next(2) (* 0がズンで1がドコ *) if x = 0 then printfn "ズン" else printfn "ドコ" yield x } zundokoSeq |> Seq.windowed 5 |> Seq.takeWhile (fun x -> x = [|0;0;0;…
今更感あるけどF#でズンドコした。 type Zundoko = Zun | Doko (* F# 4.0より前のバージョンの場合 let rand = new System.Random () *) let rand = System.Random () let randomZunDoko () = if rand.Next(2) = 0 then printfn "ズン"; Zun else printfn "…