I am learning Haskell for a university course and i have a question about reducible expressions (redexes). I understand the concept yet I still have some questions that I can't seem to figure out on my own.
Lets say you would want to find all the reducible expressions in an expression, like this:
head (map (+1) (3:repeat 3))
In this expression an obvious redex would be map (+1) (3:repeat 3))
because it matches to the definition of map
, so Haskell would "reduce" the expression and map
would increment the 3
and 4:map (+1) (repeat 3)
. would be reduced next.
The question I have is:
Is head (map (+1) (3:repeat 3))
already a redex, before map
is evaluated?
Because the "input" of head
does not match the constructor of a list (which is what head
is looking for), I am confused about whether it still is a redex because logically it can't get reduced yet, but the definitions online seem to be saying that it would be.