Multiplication tables: Difference between revisions
Content added Content deleted
Line 337: | Line 337: | ||
<lang AppleScript>on run |
<lang AppleScript>on run |
||
tableText(table(1, 12)) |
|||
end run |
end run |
||
Line 343: | Line 343: | ||
-- MULTIPLICATION TABLE |
-- MULTIPLICATION TABLE |
||
-- Int -> Int -> [[String]] |
-- table :: Int -> Int -> [[String]] |
||
on table(m, n) |
on table(m, n) |
||
Line 373: | Line 373: | ||
-- TABLE DISPLAY |
-- TABLE DISPLAY |
||
-- [[String]] -> String |
-- tableText :: [[String]] -> String |
||
on |
on tableText(lstTable) |
||
script mf |
script mf |
||
-- tableLine :: [Int] -> String |
|||
on tableLine(lstLine) |
|||
intercalate(" ", ¬ |
intercalate(" ", ¬ |
||
map( |
map(tableCell of mf of my closure, lstLine)) |
||
end |
end tableLine |
||
-- tableCell :: Int -> String |
|||
on tableCell(cell) |
|||
(characters -4 thru -1 of (" " & cell)) as string |
(characters -4 thru -1 of (" " & cell)) as string |
||
end |
end tableCell |
||
end script |
end script |
||
intercalate(linefeed, map(mClosure(mf's |
intercalate(linefeed, map(mClosure(mf's tableLine, {mf:mf}), lstTable)) |
||
end |
end tableText |
||