Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module type BOX =
- sig
- type 'a option
- exception Err of string
- val create: unit -> 'a option (*tworzenie pudełka*)
- val put: 'a* 'a option -> 'a option (*wkładanie do pudełka*)
- val pop: 'a option -> 'a option (*wyciąganie z pudełka*)
- (*val content: 'a option -> 'a*)
- end
- ;;
- module Box : BOX =
- struct
- type 'a option = 'a list
- exception Err of string
- let create() = []
- let put = function
- | (s, []) -> [s];
- | (_, _) -> raise(Err("box is full"))
- let pop = function
- | [] -> raise (Err "Box is empty")
- | h -> []
- (*
- let content = function
- | [] -> raise(Err "Box is empty")
- | h::_ -> h*)
- end
- ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement