19/04/19 08:40:44.50 TxABBsFf.net
>>818
Haskellでは%記号が分数を表すので、Data.Ratioをインポートして
import Data.Ratio
main = do
print $ zipWith (+) [1,2,3] [4,5,6]
print $ zipWith3 (\a b c -> a + b + c) [1,2,3] [4,5,6] [7,8,9]
print $ zipWith3 (\a b c -> a * b % c) [1,2,3] [4,5,6] [7,8,9]
Out:
[5,7,9]
[12,15,18]
[4 % 7,5 % 4,2 % 1]