Subject: Haskell, O'Caml, Prolog, LISP/Scheme

From: Omer Zak <[email-masked]>
Date: Wed, 09 Nov 2005 23:54:11 +0200

I am considering learning and using a really powerful programming
language for a new project, which will probably need the utmost in
expressive power.

In spite of the Subject line, I am not really considering Prolog.
However the problem domain will probably have to involve goal-seeking,
backtracking and the other goods (the problem is not well-defined, yet).

Can anyone, who has experience in two or more of the languages listed in
the Subject line, offer wisdom/insight/enlightenment about when should
one of those language be chosen over another language.  What
considrations should I take into account when selecting which language
to invest time in studying and mastering?

Learning two languages and using both to implement different parts of
the project IS an option, if you can offer good reasons to do so (I
already know C++ and Python so they can be suggested as 2nd or even 3rd
language in the project).

Please do not say "language so-and-so is the best one".  Please tell me
your criteria and allow me to decide if my problem meets your criteria
for selecting language so-and-so over its alternatives.
                                      Thanks,
                                           --- Omer
-- 
Sent from a PC running a top secret test version of Windows 97.
My own blog is at http://www.livejournal.com/users/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html

---

From: Shlomi Fish <[email-masked]>
Date: Sun, 13 Nov 2005 13:13:31 +0200

> language for a new project, which will probably need the utmost in

I never encountered a project that I couldn't do with Perl with a lot of ease. 
Some of these projects would have been very painful to do in C or in Java, 
etc..

> to invest time in studying and mastering?

Well, I'll rule out Haskell immediately. The Haskell language is problematic 
and its implementations suck quite badly. The most prominent Haskell 
implementation is ghc which can only be compiled with a recent enough version 
of itself. O'Caml is much better in this regard - it can be bootstrapped from 
C, is faster than Haskell, and the language itself is also more flexible. I 
like the Haskell syntax a bit better than the O'Caml one, but the O'Caml one 
is also pretty good.

So now we have O'Caml, LISP and Scheme. Scheme is incredibly verbose: where in 
Perl you'll write $myarray[$i]++, in Scheme it would be:

(vector-set! myarray i (1+ (vector-ref myarray i)))

Ouch! Common LISP is better in this regard. Note that Common LISP has several 
implementations with incompatible non-standard (but incredibly useful) 
extensions. So if you have to choose an implementation and stick with it.

I'd like to see a truly usable dialect of LISP with many UNIXisms, 
Perl/Python/etc. inherited features, etc. Paul Graham planned to do it with 
Arc, but Arc has been vapourware since its announcement, and Graham seems to 
take his time with it.

LISP and Perl are more similar to each other than they are to O'Caml. O'Caml 
is strongly typed, and as a result one has to worry a lot about typing 
issues, which are a no-brainer in Perl and LISP. Strongly Typed languages 
like Caml or Haskell, desperately need object oriented programming. O'Caml as 
it and so does O'Hugs, but ghc does not have it yet.

When will I use O'Caml? Probably when I need good performance and still have a 
very expressive language? When will I use Perl/LISP? Whenever I want to get 
my job done with the most ease. (and not worry too much about speed). O'Caml 
is too limiting.

I recall one time when I wrote a Perl program to calculate the Graham 
Function:

http://vipe.technion.ac.il/~shlomif/lecture/Perl/Graham-Function/

The program in Perl was a bit slow. Trying to optimise a certain function 
(which AFAIR factored a number) using micro-optimisations did not yield any 
good improvements.

Then I converted my program to O'Caml. The interpreted version was much slower 
than perl's, but after I compiled it, it ran very quickly. I believe it was 
the first program I wrote in O'Caml.

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      [email-masked]
Homepage:        http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.