[Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

Robert Dockins robdockins at fastmail.fm
Fri Oct 8 12:43:45 EDT 2004


>>x = [3,5,7]
>>primes = 2:x
>>odds = 1:x
>>You can't do sharing like this if your lists are doubly-linked; lots
>>of cool algorithms depend on this sharing.
> 
> 
> That constraint makes various other things painful. I suppose there is
> no one-size-fits-all solution.

Then perhaps it is worth considering having multiple implementations and 
  choosing between them with pragmas and/or command line switches (with 
a sensible default naturally).  Maybe doubly linked lists are not a 
great idea, but if we had a good implementation with, eg. O(1) access to 
both ends of the list but poor sharing, we can choose to use it only in 
cases where queue semantics are important and sharing is not.  It would 
be nice to be able to monkey about with that kind of "under the hood" 
functionality w/o having to make any code changes.  You could also do 
fun things like have chained-buffer list implementations for [Word8], 
[Char] etc.





More information about the Haskell-Cafe mailing list