Pabl0o0

Untitled

Nov 7th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. type ('a,'b)ab = A of 'a | B of 'b;;
  2.  
  3. let rec naPrzemian list =
  4. match list with
  5. | [] -> true
  6. | h::t -> if t!=[] then
  7. match (h, List.hd t) with
  8. |(A intt, B floatt) -> naPrzemian t
  9. |(B floatt, A intt) -> naPrzemian t
  10. | _ -> false
  11. else true
  12.  
  13.  
  14. naPrzemian [A 3;B 2.4;A 4;B 4.4;A 5;B 6.6];;
  15.  
  16. naPrzemian [B 3.3;B 2.4;A 4;B 4.4;A 5;B 6.6];;
Advertisement
Add Comment
Please, Sign In to add comment