Re:OCaml on Baremetal Shakti RISC-V Processor
by andrepd on Sunday March 31, 2019 @12:34AM
(#19533893)
You can write floating point operators in several different ways. You can write with the normal floating point operators
x *. y +. z
or, since `Float.(+) = (+.)`, `Float.() = (.)`, etc, let open Float in
x * y + z
or simply Float.(x * y + z)
Re:OCaml on Baremetal Shakti RISC-V Processor
by xyproto on Monday April 01, 2019 @03:09AM
(#19541170)
That is pretty neat. Does it mean that one could do something similar for vectors and quaternions?
let open Quaternion in
x * y + x
Re:OCaml on Baremetal Shakti RISC-V Processor
by andrepd on Tuesday April 02, 2019 @08:30AM
(#19553314)
Yep. You could write
module Quaternion = struct
let (+) =
...
let ( * ) =
...
end
then let open Quaternion in
imports the contents of Quaternion into local scope, so you can write x * y + z
It never bothered me in Caml Light, let alone when Objective Caml was introduced.