Learning Haskell: How to remove an item from a List in Haskell

The others are right that the problem is the : operator. I would say that your areTheySame function that returns a list is the wrong approach anyway, though. Rather than switch to the ++ operator, a better implementation of that function would be: As you can see, this is a pretty simple implementation. Also, consing … Read more

Using map in Haskell

For people new to functional programming map may be one of the first concepts that they struggle with. map is a function that takes two parameters: a function and a list of elements. The type signature of map is (a -> b) -> [a] -> [b]. The (a -> b) part is the function you pass to map, we will call it f. f takes one value and … Read more

Haskell pattern matching – what is it?

In a nutshell, patterns are like defining piecewise functions in math. You can specify different function bodies for different arguments using patterns. When you call a function, the appropriate body is chosen by comparing the actual arguments with the various argument patterns. Read A Gentle Introduction to Haskell for more information. Compare: with the equivalent Haskell: Note … Read more

Understanding the functions elem and isInfixOf

Your problem is with the (** a) syntactic sugar. The thing is that (elem b) is just the partial application of elem, that is: However when we use back ticks to make elem infix, we get a special syntax for infix operators which works like this: So therefore, while So in the latter case your arguments are in the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)