4interface SetSig a where
5 data SetT : Type -> Type
8 insert : a -> SetT a -> SetT a
9 member : a -> SetT a -> Bool
11Set : (a : Type) -> SetSig a => Type
12Set (a) @{sig} = SetT @{sig} a
14data Tree a = Leaf | Node (Tree a) a (Tree a)
21 [TreeSet] Ord a => SetSig a where
27 insert x Leaf = Node Leaf x Leaf
28 insert x (Node l val r) = case compare x val of
29 LT => Node (insert x l) val r
31 GT => Node l val (insert x r)
34 member x (Node l val r) = case compare x val of
39using implementation TreeSet
42 test = -- insert (the Nat 3) $
47 insert {a = Nat} (the Nat 5) new
50 foo = member (the Nat 6) test
53 bar = member (the Nat 3) test
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list