I consider myself a newbie too but here are my solutions

Tom

On Fri, 2002-01-18 at 10:14, Amrit K Patil ;012;VKSF6; wrote:
> 
> Hi,
> 
> I am newbie at Haskell.
> 
> I am not able to write a program to find the number of unique elments in a
> list in haskell.
> 
> I am also not able to write a porgram to find the elements in the
> innermost list in a list within lists.
> 
> Can anybody guide me as to g\how to go about it or better still send me
> the program.
> 
> It would be of great help.
> 
> Have a good day..
> 
> cheers,
> 
> amrit.
> 
> peace....
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

--Function that returns true if
--an element in contained in the list
contains :: Eq a => a -> [a] -> Bool

contains _ [] = False
contains a (x:xs) | a==x = True
                  | otherwise = contains a xs

--Function to remove all multiple
--occurences of elements in a list
unique :: Eq a => [a] -> [a]

unique [] = []
unique (x:xs) | contains x xs = unique xs
              | otherwise = x:unique xs

innerList :: [[a]] -> [a]

innerList = foldr (++) []

Reply via email to