2 ms·
In Haskell the numerator and denominator of the Rational type are unbounded integers, so one of the (many equivalent) ways of writing it is: ghci> sum [i %
by rotifer 2y ago
In Haskell the numerator and denominator of the Rational type are unbounded integers, so one of the (many equivalent) ways of writing it is:
ghci> sum [i % (i+1) | i <- [0..9]]
17819 % 2520
ghci>
% is the constructor for Rational numbers. I.e. one half is written (and shown as) 1 % 2.
I'll spare people the full result, but:
ghci> sum [i % (i+1) | i <- [0..999]]
70755...77483 % 71288...20000
ghci>