Created
March 25, 2014 21:44
-
-
Save laser/9772036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert :: LogMessage -> MessageTree -> MessageTree | |
insert (Unknown _) t = t | |
insert m@(LogMessage _ ts1 _) t = case t of | |
(Leaf) -> Node Leaf m Leaf | |
(Node _ (Unknown _) _) -> t | |
(Node t1 m2@(LogMessage _ ts2 _) t2) -> case ts1 < ts2 of | |
True -> Node (insert m t1) m2 t2 | |
False -> Node t1 m2 (insert m t2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment