>===== Original Message From "xoo" <[EMAIL PROTECTED]> =====
>hi.. i was just wondering if some body could give a simple equation for the
following situation.other than recursion plz..
>
>occurrences :: Eq a => a -> [a] -> [a]
>--occurrences xs ys returns the number of times that xs occurs in ys
You may find it easier if you make
occurrences :: Eq a => a -> [a] -> Integer
since it would seem it is to return a number, and not another list!
Also I would guess the function will have a form something like
occurrences x xs = foldr (countOp x) 0 xs
where countOp :: Eq a => a -> a -> Integer -> Integer
...
I'm not sure if I should go any further, in case this is a homework
question...
Andy
--
[ Andy Fugard ]
[ +44 (0)7901 603075 ]
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe