Skip to content

Instantly share code, notes, and snippets.

@kos59125
Created November 25, 2012 09:50
Show Gist options
  • Save kos59125/4142947 to your computer and use it in GitHub Desktop.
Save kos59125/4142947 to your computer and use it in GitHub Desktop.
while ループと do-while ループ的な
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