访问ocaml中的全局引用列表



我有这个代码:


let l = ref []
(*then I have this tail-recurse function 
that is supposed to recalculate with a certain formula 
all the values that are in the global reference list.*)
let f (a:int) (b:int) = 
(*here I want to put the new values a and b in the 
l - list and then do my calculations with all the contents 
in l*)

所以也许有人可以通过一个例子向我展示如何做到这一点。

l := a :: b :: !l;
(* Your code here *)

会胜任这份工作的。l := foofoo作为新值分配给l!l访问存储在l中的值

相关内容

  • 没有找到相关文章

最新更新