Ocaml:语法错误

时间:2012-01-03 16:09:04

标签: ocaml

我正在试图弄清楚为什么这不起作用,我得到错误:语法错误。我错过了一个“;”某处?

let way_tags_to_hashtbl way =
  let hashtbl = Hashtbl.create 1 in
  let rec way_tags_to_hashtbl_partial list = match list with
    | a::list' -> Hashtbl.add hashtbl (a.k, a.v); way_tags_to_hashtbl_partial list'
    | a::[] -> Hashtbl.add hashtbl (a.k, a.v)
    | [] -> [];
  way_tags_to_hashtbl_partial way.wtag; hashtbl
;; <------ ERROR HERE

谢谢。

1 个答案:

答案 0 :(得分:4)

我认为你错过了in大约两行:

let way_tags_to_hashtbl way =
  let hashtbl = Hashtbl.create 1 in
  let rec way_tags_to_hashtbl_partial list = match list with
    | a::list' -> Hashtbl.add hashtbl (a.k, a.v); way_tags_to_hashtbl_partial list'
    | a::[] -> Hashtbl.add hashtbl (a.k, a.v)
    | [] -> [] in (* !!! HERE !!! *)
  way_tags_to_hashtbl_partial way.wtag; hashtbl
;;

我没有在这台机器上安装过ocaml,无法检查......