Converting OCaml to F#: Converting OCaml open_box

2019-06-25 14:10发布

问题:

I am converting several modules based on OCaml to F# and ran into the OCaml print formatting functions open_box and close_box from the OCaml format module. After reading about the concept of a printing box, it makes sense but seems like it needs a lot of work behind the scenes to implement.

Is there an F# module that is functionally equivalent?

If not, without having to convert portions of the OCaml format module, what are quick and simple replacement functions?

EDIT

Jack has a version as part of OCaml Format at FSharpx.Compatibility.OCaml.Format.Format.fs I havent' tested it, but it is the most compelete version I have found at present.

回答1:

Is there an F# module that is functionally equivalent?

No.

If not, without having to convert portions of the OCaml format module, what are quick and simple replacement functions?

Nothing beyond printf. However, I had to translate the Format module from OCaml to F# recently and it only took a couple of hours.



标签: f# ocaml