initial implementation of building search list

This commit is contained in:
2024-11-15 05:37:53 +00:00
parent f279dc0937
commit cac0d02fab
5 changed files with 117 additions and 0 deletions

View File

@@ -2,8 +2,12 @@ signature SEARCH_LIST =
sig
type t = {left: int vector list, right: int vector list}
val empty: t
val insert: int * t -> t
val append: int * t -> t
val delete: int * int * t -> t
val goToNum: int * t -> t
val mapFromNum: int * int * t -> t
end
@@ -148,6 +152,13 @@ struct
else insLeft (new, left, right)
| [] => insLeft (new, left, right)
fun helpAppend (new, left, right) =
case right of
hd :: tl => helpAppend (new, joinEndOfLeft (hd, left), tl)
| [] => {left = joinEndOfLeft (Vector.fromList [new], left), right = right}
fun append (new, {left, right}: t) = helpAppend (new, left, right)
fun helpGoToNumLeft (num, left, right) =
case left of
hd :: tl =>