S.D.Mechveliani <[EMAIL PROTECTED]> writes
| Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes
| > 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.
This probably works fine for many applications, but of course,
it is a different function. What applications of partition need
to preserve list order?
Cheers,
--Joe
Joseph H. Fasel, Ph.D. email: [EMAIL PROTECTED]
Technology Modeling and Analysis phone: +1 505 667 7158
University of California fax: +1 505 667 2960
Los Alamos National Laboratory postal: TSA-7 MS F609
Los Alamos, NM 87545