I would start by splitting the problem up

tupleSum :: [Int]-> (Int, Int)
tupleSum     xs  =  (neg, pos)
                                where neg = ... SOME EXPRESSION INVOLVING xs
...
                                        pos = sum [ x | x <- xs , x > 0] 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 03 August 2000 16:21
> To: [EMAIL PROTECTED]
> Subject: Query
> 
> 
> 
> Hi,
> 
> Would mind asnswring the following :
> 
> Write a Haskell function tupleSum of type
> 
>     tupleSum :: [Int]-- (Int, Int)
>   
> that given a list of integers:
> 
> @separetes all negatives from the list and then add -1 to 
> each element of this sub-list;
> 
> @sum all elements of the list of negatives and sum all 
> elements of the list of positives and return these in a tuple
> 
> 
> Thanking you in advance for your assistance        
> 
> 
> 
> --------------------
> talk21 your FREE portable and private address on the net at 
http://www.talk21.com


  • Query mohamed_hassan
    • Chris Angus

Reply via email to