Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Write a function is_sorted : string array -> bool which checks if the values of the input array are sorted in strictly increasing order, implying that its elements are unique (use String.compare). *)
- let is_sorted a : bool =
- let sorted = Array.fold_left (fun initial accumulator ->
- String.compare accumulator initial) a.(0) a in
- if sorted = 0
- then true
- else false
- ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement