Created
November 25, 2012 09:50
-
-
Save kos59125/4142947 to your computer and use it in GitHub Desktop.
while ループと do-while ループ的な
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
let whileLoop condition f seed = | |
seq { | |
yield seed | |
yield! Seq.unfold (fun s -> if condition s then let next = f s in Some (next, next) else None) seed | |
} | |
|> Seq.last | |
let doWhileLoop condition f seed = whileLoop condition f (f seed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment