I am trying to check whether my second part of my tuple is 1.0 and if it is then I am storing it in the list. But I can't figure out how to implement the check.
number :: [(Integer, Double)] -> [Integer]
number lst = number' lst []
where
number' [] a = a
((mat,1.0): xs) a = number'(xs) (mat:a) -- Here I am getting my error
((_,lst): xs) a = number'(xs) a
Maybe someone has an idea.
The reason this doesn't work is because you need to write
number'for every line:But this will return the "keys" in reverse.
You can pattern match with:
You can however work with list comprehension:
or with a combination of
mapandfilter: