Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module NonEmptyList = struct
- type 'a t = Cons of 'a * 'a t | Nil of 'a
- let rec from_list l = match l with
- |[]-> None
- |x::xs ->
- begin match from_list xs with
- | None -> Some (Nil a)
- | Some r -> Some(Cons (x , r))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement