Created
March 8, 2013 12:41
-
-
Save anonymous/5116235 to your computer and use it in GitHub Desktop.
コレクション中に同じ要素を含むか。
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
open System | |
type Foo = { Field : int } | |
let random = Random () | |
Seq.initInfinite id | |
//|> Seq.take 50 // 適当に小さな値を入れたら全部違う値になる気がする | |
|> Seq.map (fun i -> { Field = random.Next (100) }) | |
|> Seq.scan (fun set key -> Set.add key set) Set.empty | |
|> Seq.windowed 2 | |
|> Seq.exists (function [| x; y |] -> x = y | _ -> failwith "") | |
|> printfn "%b" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment