Re: [hackers-il] Haskell, O'Caml, Prolog, LISP/Scheme
- On Wednesday 09 November 2005 23:54, Omer Zak wrote:
> I am considering learning and using a really powerful programmingI never encountered a project that I couldn't do with Perl with a lot of ease.
> language for a new project, which will probably need the utmost in
> expressive power.
Some of these projects would have been very painful to do in C or in Java,
> In spite of the Subject line, I am not really considering Prolog.Well, I'll rule out Haskell immediately. The Haskell language is problematic
> 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?
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
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
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.
Shlomi Fish shlomif@...
95% of the programmers consider 95% of the code they did not write, in the