
Not a good solution, it just substitutes the first occurrence of the item in the list. I'll try the others Carajillu wrote:
Finally I took Andrea's solution "check_elem (x:xs) = if x == e then (l2 ++ xs) else [x] ++ check_elem xs" I think it's easy to understand for me ( in my noob level), than the recursive one. I'm testing it and it's working really well. The other solutions are a little complicated for me, but I'm still trying to undestand them. Thanks!
Andrea Rossato wrote:
On Mon, Sep 18, 2006 at 12:25:21PM +0100, Neil Mitchell wrote:
Why not:
check_elem (x:xs) = if x == e then (l2 ++ xs) else x : check_elem xs
Thanks
Thank you! Lists are my personal nightmare...;-)
Andrea _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- View this message in context: http://www.nabble.com/Problems-interpreting-tf2290155.html#a6362912 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.