Jump to content

Multiplication tables: Difference between revisions

m
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]
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.