Guest User

Untitled

a guest
Jan 21st, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.38 KB | None | 0 0
  1. let rec isPart (l1,l2) =
  2.   if l1 = [] && l2 <> [] then false
  3.   else if l2 = [] then true
  4.   else if List.hd l1 <> List.hd l2 then isPart(List.tl l1, l2)
  5.   else if List.hd l1 = List.hd l2 then isPart(List.tl l1, List.tl l2)
  6.   else false
  7.  
  8. ;;
  9.  
  10. isPart ([1;2;3;4;5;6;7;8;9],[3;4;5]);;
  11. isPart ([1;2;3;4;5;6;7;8;9],[8;8]);;
  12. isPart ([1;2;3;4;5;6;7;8;9],[]);;
  13. isPart ([],[]);;
Add Comment
Please, Sign In to add comment