Sum of first n cubes: Difference between revisions

Content added Content deleted
(Add Cowgol)
Line 855: Line 855:


Or, in terms of scanl:
Or, in terms of scanl:
<lang haskell>import Control.Monad (join)
<lang haskell>import Data.List (intercalate, scanl, transpose)
import Data.List (intercalate, scanl, transpose)
import Data.List.Split (chunksOf)
import Data.List.Split (chunksOf)
import Text.Printf (printf)
import Text.Printf (printf)
Line 872: Line 871:
main :: IO ()
main :: IO ()
main =
main =
putStrLn $
(putStrLn . table " " . chunksOf 5) $
table " " $
show <$> sumsOfFirstNCubes 50
chunksOf 5 $
show <$> sumsOfFirstNCubes 50


------------------------- DISPLAY ------------------------
------------------------- DISPLAY ------------------------