[Haskell-cafe] Re: Interesting critique of OCaml

Richard A. O'Keefe ok at cs.otago.ac.nz
Sun May 11 20:58:36 EDT 2008


On 9 May 2008, at 6:59 am, Donnie Jones wrote:
>
> I pasted a copy of the article below for those that cannot access  
> the site.Why Ocaml Sucks
> Published by Brian at 6:49 pm under Functional Languages: Ocaml,  
> Haskell
>

> . An even better idea [for 'printf'] might be some variant of  
> functional unparsing.
>

There's a link to http://www.brics.dk/RS/98/12/.  I spent a bit of  
time last week
playing with the code in that paper.  Some of the basic ideas are  
nice; the idea
that 'formats' are functions and concatenation of formats is  
composition of
functions was particularly nice.  But seeing it with Haskell eyes, the  
idea of
building strings up using cascades of (basically) \s x -> s ++ f x,  
where s is a
byte string, not a list, and ++ is concatenation of byte strings,  
seemed obviously
wrong.  I replaced it by \sl x -> f x : sl, with the final step (in an  
already
existing interface function) being to reverse all the stringlet and  
concatenate
them in one big step.   I was gratified, but the very reverse of  
surprised, to get
a substantial speedup.  (A factor of over 100 for a small but non- 
trivial test,
using SML/NJ.)  In effect, thinking in terms of "shows" paid off  
handsomely.

Haskell-think wins again!



More information about the Haskell-Cafe mailing list