Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let combinations combine l l' =
- CCList.cartesian_product [l; l']
- |> CCList.map (fun [p; p'] -> combine p p')
- let paths xmax ymax =
- let rec aux x y prev_paths =
- if x > xmax || y > ymax then []
- else if x = xmax && y = ymax then prev_paths
- else
- let next_paths = List.flatten [
- aux (x+1) y [[ `Right ]];
- aux x (y+1) [[ `Down ]];
- ] in
- combinations (@) prev_paths next_paths
- in
- aux 0 0 [[]]
Add Comment
Please, Sign In to add comment