I am having this interpretation error which I do not know what is wrong
module Series where
series :: Double -> Double
series i1 = zipWith (/) (map (i1^)[1..]) (map(\x -> product[1..x]) [1..])
The error I have is
Couldn't match expected type `Double' with actual type `[c0]'
In the return type of a call of `zipWith'
In the expression:
zipWith
(/) (map (i1 ^) [1 .. ]) (map (\ x -> product [1 .. x]) [1 .. ])
In an equation for `series':
series i1
= zipWith
(/) (map (i1 ^) [1 .. ]) (map (\ x -> product [1 .. x]) [1 .. ])
Failed, modules loaded: none.
Anyone can help? Thanks in advance!
It's easy to find the answer by yourself with ghci:
> let series i1 = zipWith (/) (map (i1^)[1..]) (map(\x -> product[1..x]) [1..])
> :t series
series :: (Enum c, Fractional c) => c -> [c]
I do not know what is wrong
Your signature is wrong and compiler cannot match actual function type with your one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.