• + 1 comment

    UPDATE: The program now prints a nested array. Still trying to get Haskell to format basic output? (Output of below is [[1],[1,1],[1,2,1],[1,3,3,1]])

    -- print tri value at coords
    pas m n
        | n == 0 = 1 
        | m == n = 1
        | otherwise = pas (m-1) (n-1) + pas (m-1) n
          
    -- print row of triangle 
    row m = map (pas m) [0..m]   
        
    -- print triangle until row
    tri m = map (row) [0..(m-1)] 
        
    main = do   
       m <- readLn :: IO Int
       print (tri m) -- print tri to row m