While
map (\x -> x * x) [0..9]
is working fine (also list comprehension), I cannot do
map (** 2) [0..9]
since the power operator requires doubles and the .. operator does not allow them.
Is there some mapping that I can use?
While
map (\x -> x * x) [0..9]
is working fine (also list comprehension), I cannot do
map (** 2) [0..9]
since the power operator requires doubles and the .. operator does not allow them.
Is there some mapping that I can use?
The reason is that Double is not an instance of Enum.
There are 2 possibilities:
For example:
or, if you prefer: