Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes
> S.D.Mechveliani <[EMAIL PROTECTED]> pisze:
>> But "filter-filter" implementation needs a constant space for
>>
>> head $ fst $ partition (==1) [0..n].
>>
>> And some recent implementations take heap+stack proportional to n.
> partition _ [] = ([], [])
> partition p (x:xs) = if p x then (x:ys, zs) else (ys, x:zs)
> where (ys, zs) = partition p xs
>
> runs your example in constant space.
Probably, this will do. What the Haskell implementors say?
And we have to add that this was suggested 2-3 days ago by someone in
this maillist.
------------------
Sergey Mechveliani
[EMAIL PROTECTED]