Multiplication tables: Difference between revisions

Content deleted Content added
Chkas (talk | contribs)
Hout (talk | contribs)
m →‎AppleScript: (tidied)
Line 541:
 
{{trans|JavaScript}} (ES5 functional version)
<lang AppleScript>tableText(multTable(1,------------------- 12))MULTIPLICATION TABLE -----------------
 
-- multTablemultiplicationTable :: Int -> [[String]]
on multTablemultiplicationTable(m, n)
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 multTablemulTable
 
-- TABLE DISPLAY --------------------------------------------------------------
 
-- tableText :: [[Int]] -> String
Line 587 ⟶ 593:
 
 
-- GENERIC FUNCTIONS --------------------------------- TEST -------------------------
on run
multiplicationTable(12)
end run
 
 
-------------------- GENERIC FUNCTIONS -------------------
 
-- concatMap :: (a -> [b]) -> [a] -> [b]