Hey I am pretty new to Haskell.
So I want to eliminate all integers which are greater than 500 in a list.
import Data.List leng x = if(head x > 500) then leng(tail x) else [head x]++leng(tail x) I get the right output but at the end of each output is
Exception: Prelude.head: empty list
how to fix that problem?
(h:t)instead of[h]++t(so here(head x):(leng (tail x))). (:) is Haskell's cons function, adding a single item to the front of a list.