[Haskell-cafe] Re: Data constructors versus types

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Jan 16 22:19:44 EST 2008

On 17 Jan 2008, at 10:56 am, Peter Verswyvelen wrote:
> You're talking about O(big)... But wasn't the C language in some way
> succesful because on the hardware at that time other much nicer
> languages (e.g. LISP) were just way too slow? Or was this just O(n)
> times slower?

No.  C was designed as a Systems Implementation Language (there were  
lots of
SILs) with the following advantages:
(1) tolerable code from a fairly naive compiler (the PDP-11 UNIX V7 C  
     did a little optimisation, but not very much; function entry/ 
exit was done
     using calls to library support routines in order to save space,  
so every
     function call involved *three* hardware-level function calls; I  
speeded up
     a text editor by about 20% by replacing just two tiny functions  
by hand-
     written assembler, and it was this function call overhead that  
was saved)
(2) tolerably compact code; a fairly useful library of stuff that you  
     actually have to use (again, said text editor got a notable  
space saving
     by *not* using any C stdio stuff at all, not using any floating  
point stuff
     at all, and not even linking, let alone calling, malloc())
(3) fairly direct mapping between language and machine so the  
"performance model"
     you had to keep in your head was simple
(4) a fair degree of portability between compilers (although the PC  
     spoiled this to some extent).

Lisp *performance* compared with C was always O(1) and sometimes  
I have had Scheme code running faster than C.  It was the memory  
caused by Lisp's comparatively large library (possibly even including  
compiler) always being there in full, and the (largely imaginary)  
cost of
garbage collection which scared people off.  It is intensely annoying  
to an
old Lisp hacker to see Java succeeding despite being worse at just about
everything Lisp was ever criticised for.  But in fairness, the other  
thing was
that before the advent of Common Lisp, every Lisp was different.   
Develop in
MacLisp and you could forget about delivering in Interlisp, and vice  
This is why, although I actually have Lazy ML on my machine still, I  
it for Haskell.

More information about the Haskell-Cafe mailing list