[Haskell-cafe] Problems interpreting

Andrea Rossato mailing_list at istitutocolli.org
Mon Sep 18 07:22:43 EDT 2006

On Mon, Sep 18, 2006 at 04:16:55AM -0700, Carajillu wrote:
> Wow! I'm starting to love this languaje, and the people who uses it!:)

You spoke too early. My code had a bug, a huge one...

this is the right one:

-- Replaces a wildcard in a list with the list given as the third argument
substitute :: Eq a => a -> [a] -> [a] -> [a]
substitute e l1 l2= [c | c <- check_elem l1]
    where check_elem [] = l1
          check_elem (x:xs) = if x == e then (l2 ++ xs) else [x] ++ check_elem xs


More information about the Haskell-Cafe mailing list