Closed nilsbecker closed 2 years ago
ocaml 4.13.0, anaconda python 3.7 (maybe I should add that I did not install the python@3 opam package, as I prefer not to maintain more than one python distribution on my system -- could this be a problem here?)
Thank you for reporting and for your interest in this package! The two problems you reported should be fixed now.
Great. One more impression, if I may: In reading the conversion rules I found a lot of info how ocaml values are converted to python ones. But not the other way around. It appears to me that already in the first example:
import ocaml
print(ocaml.List.map((lambda x : x + 1), [1, 2, 3]))
# => output: [2;3;4]
a python anonymous function is mapped over an ocaml list? At least that's what I think happens: ocaml.List.map
is the python callable that in turn calls List.map
in ocaml. List.map
expects an ocaml function, which must be the ocaml version of lambda x: x + 1
. So this lambda has to be converted from python to ocaml. correct? My point is just that this backwards conversion is not mentioned in the docs.
All conversions should be bidirectional, and I agree I should put more emphasis on this in the documentation. When the documentation says that "OCaml type x
is mapped to Python type y
", that means that OCaml values of type x
are converted to Python values of type y
and that Python values of type y
are converted to OCaml values of type x
.
I'm impressed and excited for this package.
When going through the README example, I noticed that somevalue. works on the module or ocaml.List. gives no options in ipython). Could this be added?
m
compiled on-the-fly, but does not work for the builtin ocaml module (i.e. ocaml.Importing the ocaml
csv
package did not work for me.