ocaml: phase 6 Hashtbl (+6 tests, 332 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Backing store is a one-element list cell holding a SX dict; keys coerced to strings via str so int/string keys work uniformly. API: create, add, replace, find, find_opt, mem, length. _hashtbl_create / _hashtbl_add / _hashtbl_replace / _hashtbl_find_opt / _hashtbl_mem / _hashtbl_length primitives wired in eval.sx; OCaml-side Hashtbl module wraps them in lib/ocaml/runtime.sx.
This commit is contained in:
@@ -266,6 +266,19 @@
|
||||
module Printf = struct
|
||||
let sprintf fmt = fmt
|
||||
let printf fmt = print_string fmt
|
||||
end ;;
|
||||
|
||||
module Hashtbl = struct
|
||||
let create n = _hashtbl_create n
|
||||
let add t k v = _hashtbl_add t k v
|
||||
let replace t k v = _hashtbl_replace t k v
|
||||
let find_opt t k = _hashtbl_find_opt t k
|
||||
let find t k =
|
||||
match _hashtbl_find_opt t k with
|
||||
| None -> failwith \"Hashtbl.find: not found\"
|
||||
| Some v -> v
|
||||
let mem t k = _hashtbl_mem t k
|
||||
let length t = _hashtbl_length t
|
||||
end")
|
||||
|
||||
(define ocaml-stdlib-loaded false)
|
||||
|
||||
Reference in New Issue
Block a user