absviewtype gIdxMaptypedef gIdxMap (n:int) = gIdxMap n
externfun gIdxMap_find {n:nat} (mp: &gIdxMap n, k: string): intBtw(0,n) i
externfun gIdxMap_free(mp: gIdxMap):<> void
externfun gIdxMap_insert {i,n:nat | i < n} (mp: &gIdxMap n, gene: string, ival: intBtw(0,n) i):<> bool
externfun gIdxMap_make_nil(): gIdxMap
local
staload LM = "libats/SATS/linmap_avltree.sats" staload _ = "libats/DATS/linmap_avltree.dats" assume gIdxMap = {n:nat} $LM.map(string, intBtw(0,n))
in // in of [local]
implement gIdxMap_make_nil() = $LM.linmap_make_nil {string, int} ()
implementgIdxMap_find {n:nat} (mp n, k): intBtw(0,n) i = let var res: int? val b = $LM.linmap_search (mp, k, lam(x,y) => compare_string_string(x,y), res) in if b then let prval () = opt_unsome {int} (res) in res end else let prval () = opt_unnone {int} (res) in ( (* print(k + "not found\n"); $raise MapKeyNotFound;*) ~1.0) end end // end of [gIdxMap_find]
implementgIdxMap_free(mp) = $LM.linmap_free(mp)
implementgIdxMap_insert (mp n,gene, ival i) = let var rdval: int? val b = $LM.linmap_insert<string,int> (mp, gene, dval, lam(x,y) => compare_string_string(x,y),rdval) //How does this work?: prval () = opt_clear (rdval) in b end
end // end of [local]
assume gIdxMap_vtype(n:int) = $LM.map(string, intBtw(0,n))
absviewtype gIdxMap_vtype (n:int)viewdef gIdxMap (n: int) = gIdxMap_vtype (n)
externfun gIdxMap_find {n:nat} (mp: &gIdxMap n, k: string): intBtw(~1,n)
externfun gIdxMap_free {n:nat} (mp: gIdxMap n):<> void
externfun gIdxMap_insert {n:nat} (mp: &gIdxMap n, gene: string, ival: intBtw(~1,n)):<> bool
externfun gIdxMap_make_nil {n:nat} (n:int n): gIdxMap n
local
staload LM = "libats/SATS/linmap_avltree.sats"staload _ = "libats/DATS/linmap_avltree.dats"
assume gIdxMap_vtype(n:int) = $LM.map(string, intBtw(~1,n))
in // in of [local]
implement
gIdxMap_make_nil {n:int} (n:int n) =$LM.linmap_make_nil {string, intBtw(~1,n)} ()
implementgIdxMap_find {n:int} (mp: &gIdxMap n , k) = let var res: intBtw(~1,n)
val b = $LM.linmap_search (mp, k, lam(x,y) => compare_string_string(x,y), res) in if b then let
prval () = opt_unsome {Int} (res)
in res end else let
prval () = opt_unnone {Int} (res) in ( (* print(k + "not found\n"); $raise MapKeyNotFound;*) ~1) end
end // end of [gIdxMap_find]
implement
gIdxMap_free(mp) = $LM.linmap_free(mp)
implementgIdxMap_insert (mp, gene, ival) = let var rdval: int? val b = $LM.linmap_insert<string,Int>(mp, gene, ival, lam(x,y)
gIdxMap_find {n:int} (mp: &gIdxMap n , k) = let
changes to
implement
gIdxMap_find {n} (mp, k) = let
(*
the static 'n' is available here.
*)
absviewtype gIdxMap_vtype (n:int)viewdef gIdxMap (n: int) = gIdxMap_vtype (n)
externfun gIdxMap_find {n:nat} (mp: &gIdxMap n, k: string): intBtw(~1,n)
externfun gIdxMap_free {n:nat} (mp: gIdxMap n):<> void
externfun gIdxMap_insert {n:nat} (mp: &gIdxMap n, gene: string, ival: intBtw(~1,n)):<> bool
externfun gIdxMap_make_nil {n:nat} (n:int n): gIdxMap n
local
staload LM = "libats/SATS/linmap_avltree.sats"staload _ = "libats/DATS/linmap_avltree.dats"
assume gIdxMap_vtype(n:int) = $LM.map(string, intBtw(~1,n))
in // in of [local]
implementgIdxMap_make_nil {n:int} (n:int n) =$LM.linmap_make_nil {string, intBtw(~1,n)} ()
implementgIdxMap_find {n} (mp, k) = let
var res: intBtw(~1,n)?
val b = $LM.linmap_search (mp, k, lam(x,y) => compare_string_string(x,y), res) in if b then let
prval () = opt_unsome {intBtw(~1,n)} (res)
in res end else let
prval () = opt_unnone {intBtw(~1,n)} (res)
in ( (* print(k + "not found\n"); $raise MapKeyNotFound; *) ~1) end end // end of [gIdxMap_find]
implementgIdxMap_free(mp) = $LM.linmap_free(mp)
implement
gIdxMap_insert {n} (mp, gene, ival) = let var rdval: intBtw(~1,n)?
val b = $LM.linmap_insert<string, intBtw(~1,n)>(mp, gene, ival, lam(x,y)
lam(x:string,y:string):int =<cloref> compare (x, y)
in
...
end