Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let two () =
- let rec largestCast xs movies maximum =
- match xs with
- |[] -> movies
- |x :: xs ->
- match x with (movie, cast) ->
- match (compare (List.length cast) maximum) with
- |1 -> largestCast xs (movie :: []) (List.length cast)
- |0 -> largestCast xs (movie :: cast) maximum
- | -1 -> largestCast xs movies maximum
- |_ -> failwith "How tf did you get here what"
- in
- largestCast (Map.bindings fcMap) [] 0
- let _ =
- let rec printList xs =
- match xs with
- | [] -> ()
- | x :: xs ->
- Code.pfmt "%s\n" x
- ; printList xs
- in
- let ls = two ()
- in
- Code.pfmt "The movies with the largest cast are the following: \n"; (printList ls)
- let five () = let bind = Map.bindings fcMap in
- let rec exists key ls =
- match ls with
- |[]-> false
- |l::ls ->
- match (key = l) with
- |true -> true
- |false -> exists key ls
- in
- let rec helperFive ls actor movies =
- match ls with
- |[] -> movies
- |l::ls ->
- match l with (key, actors) ->
- match (exists actor actors) with
- |false -> helperFive ls actor movies
- |true -> helperFive ls actor (movies ^ ", " ^ key)
- in
- helperFive bind "Owen Wilson" ""
- let _ =
- let str = five ()
- in
- Code.pfmt "Movies with Owen are as following%s." str; Code.pfmt "\n"
- let nine () =
- let rec largestMovies xs actors maximum =
- match xs with
- |[] -> actors
- |x :: xs ->
- match x with (actor, movie) ->
- match (compare (List.length movie) maximum) with
- |1 -> largestMovies xs (actor :: []) (List.length movie)
- |0 -> largestMovies xs (actor :: actors) maximum
- | -1 -> largestMovies xs actors maximum
- |_ -> failwith "How tf did you get here what"
- in
- largestMovies (Map.bindings afMap) [] 0
- let _ =
- let ls = nine ()
- in
- Code.pfmt "The Actors with the most Movies done are the following: \n"; (printList ls)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement