trying to close over local vars too when calling ocaml functions