Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec cMap f = function
- | [] -> [1]
- | x::xs -> (f x)::(cMap f xs)
- let paskalNext l = 1::(l |> List.pairwise |> cMap (fun (a, b) -> a+b))
- let paskal n =
- let rec paskal' n acc =
- if n = 1 then acc
- else paskal' (n-1) (paskalNext(acc.Head)::acc)
- if n <= 0 then []
- else paskal' n [[1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement