|
|
|
|
|
by antisemiotic
2504 days ago
|
|
In both SML and OCaml writing a function that's polymorphic over numeric types is a huge pain in the ass, so I'm not sure it's a good choice for numeric programming. (Unless you count Haskell as a member of the ML family?) Though it could be that generics aren't that important here, and I'm just a weirdo who liked to do things like implementing a dual number type to get forward-mode automatic differentiation of standard functions for free... |
|
What? In numeric programming we usually want the opposite, to write a function for specific type, and to make it run fast.
Also, in OCaml you can simply make your computation a parametric module of some algebraic structure, something like
And have a completely static numeric computation without any dynamic dispatch. That's resembling C++'s templates.You also can use classes if you want dynamic dispatch