Re: producing and consuming lists

2002-11-05 Thread Jorge Adriano
> streams :: (Int -> Bool, Int -> Bool) -> (Int,Int) -> >[(Maybe Int,Maybe Int)] > streams (p,q) (x,y) > > | p x && p y = (Just x , Just y ) : xs > | p x= (Just x , Nothing) : xs > | p y= (Nothing, Just y ) : xs > | otherwise = xs > > where xs = str

Re: producing and consuming lists

2002-11-05 Thread Jorge Adriano
> I think you have a choice between risking a space leak and repeating > evaluation. Well, sometimes neither is a good option... > If you use 'streams' like this > > let (xs, ys) = streams ... > in -- anything which requires the first element of xs while ys may > -- still be us

Re: producing and consuming lists

2002-11-05 Thread Hal Daume III
Hrm. This is interesting. So one option you already considered would be to put the writing inside 'streams', which probably should be disprefered. Have you considered doing something like: streams :: (Int -> Bool, Int -> Bool) -> (Int,Int) -> [(Maybe Int,Maybe Int)] streams (p,q) (x,

producing and consuming lists

2002-11-05 Thread Tom Pledger
Jorge Adriano writes: : | streams :: (Int->Bool, Int->Bool)->(Int, Int)->([Int],[Int]) | streams (p,q) (x,y) = (xs',ys') | where | (xs,ys) = streams (p,q) ((x+y),(y-x)) | xs' = if p x then x:xs else xs | ys' = if q y then y:xs else ys | | | - produces a pair of ('infinit

producing and consuming lists

2002-11-05 Thread Jorge Adriano
I might have been not very clear in my last mail. I decided to post again, and go straight to the point, with some small examples. Consider the following function streams. streams :: (Int->Bool, Int->Bool)->(Int, Int)->([Int],[Int]) streams (p,q) (x,y) = (xs',ys') where (xs,ys) = streams

Another Job

2002-11-05 Thread David Barton
There is also a job here: http://www.edaptive.com/career/index.htm It isn't exactly functional programming or Haskell, but it is related (more so than it looks from the job description). Please do consider it, if it sounds interesting to you. Dave Barton EDAptive Computing ___