`partition'

2000-01-19 Thread S.D.Mechveliani
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 proportio

Re: `partition'

2000-01-19 Thread Joe Fasel
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. | | | Proba

Type inference and binding groups

2000-01-19 Thread Keith Wansbrough
Type inference for Haskell (as described in Mark Jones' paper _Typing Haskell In Haskell_ and as performed by GHC) requires first splitting groups of let bindings into strongly-connected components. It then assumes that all binders in such a component will be generalised over the same vector

`partition'

2000-01-19 Thread S.D.Mechveliani
To | > 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. Joe Fasel <[EMAIL PROTECTED]> writes > This probably works fine for many applications, but of course, > it

Positive Num ?

2000-01-19 Thread Eileen Head
Is there an easy way to define a new class, X, of types which is a class of some range of types in an existing class Y. For example can you define a class PosNum in which the type in the class are positive Ints, positive Integers, positive Floats and positive Doubles?

RE: Type inference and binding groups

2000-01-19 Thread Mark P Jones
Hi Keith, | Type inference for Haskell (as described in Mark Jones' paper _Typing | Haskell In Haskell_ and as performed by GHC) requires first splitting | groups of let bindings into strongly-connected components. It then | assumes that all binders in such a component will be generalised ove

Re: `partition'

2000-01-19 Thread Joe Fasel
Duh! Please forgive my stupidity. We were talking about this definition of partition: > partition _ [] = ([], []) > partition p (x:xs) = if p x then (x:ys, zs) else (ys, x:zs) > where (ys, zs) = partition p xs But all the time, I was thinking about this one: > partition p xs = partit

Positive Num ?

2000-01-19 Thread Tom Pledger
Hi. I'm 80% confident in this reply, and 99% confident that someone will correct me if it's wrong or misleading. :-) Eileen Head writes: > Is there an easy way to define a new class, X, of types which is a > class of some range of types in an existing class Y. Yes, but only if the existing t

partition and lifted products

2000-01-19 Thread Joe Fasel
Folks, I claimed that these are different functions: > partition1 p xs = (filter p xs, filter (not . p) xs) > partition2 p = foldr (\x (ys, zs) -> if p x then (x:ys,zs) else (ys,x:zs)) > ([],[]) I was correct, but not for the reason I thought. Nota bene: partition1

Re: `partition'

2000-01-19 Thread Matt Harden
Joe Fasel wrote: > > 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

Re: `partition'

2000-01-19 Thread Matt Harden
Oops, everything I said had already been said elsewhere in the discussion; I just hadn't read it all yet. Sorry for the waste of bandwidth. Matt Harden wrote: << a bunch of stuff that others had already said >>