Magic squares of odd order: Difference between revisions

m (J: oops, diagonals matter)
Line 387:
to allow for first class functions and closures.
 
<lang AppleScript>---------------- oddMagicSquareMAGIC ::SQUARE IntOF ->ODD [[Int]]ORDER ---------------
 
-- oddMagicSquare :: Int -> [[Int]]
on oddMagicSquare(n)
cond(if 0 < (n mod 2) > 0, ¬then
cycleRows(transpose(cycleRows(table(n)))), ¬
else
missing value)
end if
end oddMagicSquare
 
 
-- TEST ---------------------------------------------- TEST -------------------------
on run
-- Orders 3, 5, 11
Line 448 ⟶ 453:
 
 
-- GENERIC FUNCTIONS --------------------------------------- GENERIC FUNCTIONS -------------------
 
-- intercalate :: Text -> [Text] -> Text
Line 521 ⟶ 526:
end transpose
 
 
-- WIKI DISPLAY ---------------------------------------------------------------
 
-- WIKI DISPLAY ------------------------------------------ WIKI DISPLAY ---------------------
 
-- formattedTable :: [[Int]] -> String
9,655

edits