Magic squares of doubly even order: Difference between revisions
Content deleted Content added
m →{{header|AppleScript}}: ( slight reordering ) |
|||
Line 43:
{}
else
script scale▼
on lambda(x)▼
replicate(n / 4, x)▼
end lambda▼
end script▼
set sqr to n * n
Line 53 ⟶ 48:
set maybePowerOfTwo to asPowerOfTwo(sqr)
if maybePowerOfTwo is not missing value then
-- For
-- yields the truth table that we need
set truthSeries to magicSeries(maybePowerOfTwo)
else
-- where n is not
-- minimum truth table, horizontally and vertically
▲ script scale
▲ on lambda(x)
▲ replicate(n / 4, x)
▲ end lambda
▲ end script
set truthSeries to ¬
flatten(scale's lambda(map(scale, splitEvery(4, magicSeries(4)))))
Line 129 ⟶ 131:
-- GENERIC FUNCTIONS ---------------------------------------------------------------------------
-- splitEvery :: Int -> [a] -> [[a]]
|