Jacobi symbol: Difference between revisions
Content deleted Content added
m →{{header|Haskell}}: Disaggregated the tabulation functions a little |
|||
Line 290:
------------------------- DISPLAY -------------------------
jacobiTable :: Int -> Int -> String
jacobiTable nCols nRows =
withColumnLabels ("" : fmap show [0 .. nCols]) $▼
colLabels = [0 .. pred nCols]
▲ labelledRows (fmap show [1,3 .. (2 * nRows)]) $
paddedCols $▼
labelledRows (fmap show rowLabels) $
chunksOf nRows $▼
▲ paddedCols $
uncurry jacobi <$> ((,) <$> [0 .. pred nCols] <*> [1,3 .. (nRows * 2)])▼
▲ chunksOf nRows $
-------------------------- TEST ---------------------------
main :: IO ()
main = putStrLn $ jacobiTable 11 9
------------------ TABULATION FUNCTIONS -------------------
paddedCols
=> [[a]] -> [[String]]
paddedCols cols =
let scols = fmap show <$> cols
|