Multiplication tables: Difference between revisions
m
→AppleScript: (tidied)
m (→AppleScript: (tidied)) |
|||
Line 541:
{{trans|JavaScript}} (ES5 functional version)
<lang AppleScript>
--
on
tableText(mulTable(1, n))
end multiplicationTable
-- mulTable :: Int -> Int-> [[String]]
on mulTable(m, n)
set axis to enumFromTo(m, n)
Line 565 ⟶ 572:
{{"x"} & axis} & concatMap(column, axis)
end
-- tableText :: [[Int]] -> String
Line 587 ⟶ 593:
on run
multiplicationTable(12)
end run
-------------------- GENERIC FUNCTIONS -------------------
-- concatMap :: (a -> [b]) -> [a] -> [b]
|