Magic squares of singly even order: Difference between revisions

→‎{{header|Haskell}}: Some top level comments
(→‎{{header|Haskell}}: Added comments)
(→‎{{header|Haskell}}: Some top level comments)
Line 464:
magic :: Int -> [[Int]]
magic n =
let d = (2 * n) + 1 -- LUX table size
startXY = (quot d 2, 0) -- Middle of top row
in threadRows . concat . snd $
mapAccumR -- Numbering of higher-resolution coordinates
mapAccumR
(\a (xy, c) -> (a + 4, luxNums xy c a))
1 -- Initial number
1
(luxPath (luxPattern n) (siamPath (d - 1) [(quot d 2, 0)startXY]))
 
-- Size required -> square of L U X cells with two mixed rows
9,655

edits