Don Stewart <[EMAIL PROTECTED]> writes:

>>>  splitAt n xs =  (take n xs, drop n xs)

>> Thanks.  That is odd, though.  It makes me wonder what to expect re 
>> optimization.  Would the compiler/runtime know that splitAt could be 
>> done in a single pass?

> Not with that definition. It would require some moderately unusual fusion
> combining the take and drop into a single fold with the (,) on the inside,
> rather than on the outside.

Uhm, but I'm quite sure I saw a paper about how the garbage collector
could discover this, and update both thunks simultaneously.
(Unfortunately, I can't seem to find it now.)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to