Created
July 2, 2014 05:37
-
-
Save v2m/87911eb452fc63bbbc47 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
let rec takeWhileFreshConsTail cons p l = | |
match l with | |
| [] -> | |
setFreshConsTail cons [] | |
| x::xs -> | |
if p x then | |
let cons2 = freshConsNoTail x | |
setFreshConsTail cons cons2 | |
takeWhileFreshConsTail cons2 p xs | |
else | |
setFreshConsTail cons [] | |
let takeWhile p l = | |
match l with | |
| [] -> [] | |
| [x] -> if p x then l else [] | |
| x::xs -> | |
let cons = freshConsNoTail x | |
takeWhileFreshConsTail cons p xs | |
cons |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment