Changed elem definition to get code which is easier to rewrite:
Changed elem definition to get code which is easier to rewrite:

elem a as = any (== a) as

instead of

elem a as = not $ null (filter (== a) as)
          = not $ (length (filter (== a) as) == 0)

ulricha/dsh