Wednesday, October 19, 2005

Programming language of the moment

During my search for the perfect programming language, I occassionally stumble upon functional languages. They are used mostly by old bearded people in white coats for mathematical problems.


However, Ocaml (or Caml) is supposedly able to generate native code whose speed is comparable with compiled C! That piqued my interest and I tried minimal Ocaml raytracer, whose speed was really suprising. Also note the whole raytracer is only 222 lines long. Another feature of functional languages seems to be the density of code - the ability to "say more" in less number of lines. But that also means you have to think more in order to code less.


If you have spare time and want to give Ocaml a try, read this online book. It's a good thing to refresh your brain by learning new programming philosophy that forces you to forget the design patterns you knew from procedural languages. It's really like when I started learning the first BASIC commands 25 years ago...

5 comments:

  1. Ouch, author just reinvented functional programming... only 40 years after Lisp and 20 years after ML :-)

    ReplyDelete
  2. Yes, Lisp is 40 years old. Now, just try to write an easily readable, modular and efficiently compilable program in Lisp. On in ML. See the point?

    ReplyDelete
  3. Btw. Yahoo Stores are writen in Lisp...

    ReplyDelete
  4. Browse the related links at the bottom of my ray tracer page and you'll find much shorter versions written in several languages, detailed side-by-side comparisons of different languages and a benchmark comparing performance and verbosity.

    ReplyDelete