Writing more efficient code

Jon Harrop jon at ffconsultancy.com
Mon Jan 1 17:21:36 EST 2007


bearophileHUGS at lycos.com wrote:
> Jon Harrop:
>> OCaml's pattern matcher is very sophisticated and very fast. You'll
>> probably shrink your code by several fold whilst also having it run a few
>> orders of magnitude faster and having it statically checked, so it will
>> be more reliable.
> 
> You seem to forget some months of time to learn OCaml.

I think most people could pick up the core ideas in a day and start writing
working programs. Just read:

  http://www.ffconsultancy.com/free/ocaml
  http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html

> And my Python programs seem reliable enough despite being unstatically
> checked :-)

Damn. ;-)

>> You might want to look at any language with pattern matching: OCaml, SML,
>> Haskell, F#, Mathematica etc.
> 
> Mathematica pattern matching is good, but Mathematica costs a lot of
> money (and you need some time to learn it, it's not an easy system).

Mathematica is expensive but learning to use pattern matching is much easier
than learning how to write a pattern matcher and much less tedious than
reimplementing it yourself all the time (which is exactly what the OP will
end up doing).

-- 
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/index.html?usenet



More information about the Python-list mailing list