News for hackers. Stuff that matters.
Re:OCaml on Baremetal Shakti RISC-V Processor by rixed on Friday March 29, 2019 @12:55PM (#19523383)
OCaml is very good at symbolic computations, and not so good at floating point computations. Therefore it's a very good language for writing compilers etc.

Further than that, there are no more programs written in it for the same reason than there are no more programs written in any interesting languages, I guess; ie largely accidental.

Re:OCaml on Baremetal Shakti RISC-V Processor by oconnor0 on Friday March 29, 2019 @01:04PM (#19523480)
> and not so good at floating point computations

What does this mean? I was under the impression the OCaml compiler did a decent number of floating point specific optimizations, like unboxed arrays and what not.

Re:OCaml on Baremetal Shakti RISC-V Processor by noir_lord on Friday March 29, 2019 @01:09PM (#19523538)
Surprised me as well janestreet are a well known user of ocaml and I can't imagine they don't use a lot of floats.
Re:OCaml on Baremetal Shakti RISC-V Processor by pjmlp on Saturday March 30, 2019 @01:53AM (#19528009)
I guess it is the typical complain about using separate operators for ints and floats.

It never bothered me in Caml Light, let alone when Objective Caml was introduced.

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
Re:OCaml on Baremetal Shakti RISC-V Processor by vrotaru on Monday April 01, 2019 @04:05AM (#19541405)
Yes.
Re:OCaml on Baremetal Shakti RISC-V Processor by oconnor0 on Saturday March 30, 2019 @06:46PM (#19532431)
Ah, maybe, perhaps I am in the minority that liked the different operators for ints and floats. :D
Re:OCaml on Baremetal Shakti RISC-V Processor by rixed on Sunday March 31, 2019 @01:21AM (#19534039)
Symbols (variants with our without parameters) and integers are unboxed, while floats are not (but in a few specific cases such as arrays of floats, and iiuc that's an inelegant special case on its way out, as it prevents other optimisations).