Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module CallCC =
- let rec private mapk k mapper = function
- | [] -> k []
- | h :: t ->
- mapk (fun x -> k((mapper h) :: x)) mapper t
- let map = mapk id
- let rec private filterk k predicate = function
- | [] -> k []
- | h :: t -> t |> filterk (fun x -> k (if (predicate h) then h :: x else x)) predicate
- let filter = filterk id
- [1..10000] |> CallCC.map (fun x -> x * x) |> CallCC.filter (fun x -> (x % 2) = 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement