On Sun, Dec 22, 2002 at 04:00:45AM -0800, Jyrinx wrote: > As an experiment for a bigger project, I cooked up a simple program: It > asks for integers interactively, and after each input, it spits out the > running total. The wrinkle is that the function for calculating the > total should be a non-monadic stream function (that is, type [Integer] > -> [Integer] so that runningTotals [1,2,3,4,5] == [1,3,6,10,15]). The > task is then to write a function to return a stream of integers, > grabbing them from IO-land lazily (a la getContents).
Hi, what about module Main where main = getContents >>= mapM_ print . scanl1 (+) . map read . lines Happy hacking, Remi -- Diese Augen haben es gesehen Doch diese Augen schliessen sich Und ungehindert fliesst das Blut Und das Schweigen wird unerträglich laut _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe