[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jon Harrop <jon@f...> |
| Subject: | Re: [Caml-list] Operator overloading |
On Thursday 08 March 2007 23:20, Robert Fischer wrote: > > let result = > > let (+) = Vector.add and ( * ) (x:int) (v:Vector.t) = > > Vector.scalarmul x v > > in 3 * a + 2 * b > > I didn't realize that existed. It's not so bad -- it lets me have my > cake and Jon eat it, too. :D I've been using that style for years and it just doesn't hack it. Firstly, note the verbosity compared to: let result = 3*a + 2*b then note that many arithmetic expressions mix types, so you still end up needing +, +., +/, +| and +||. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists