Multiplication tables: Difference between revisions

Content added Content deleted
m (→‎AppleScript :: Functional: Tweaked types for simpler separation between model and display)
Line 546: Line 546:
on multiplicationTable(n)
on multiplicationTable(n)
tableText(mulTable(enumFromTo(1, 12)))
tableText(mulTable(enumFromTo(1, n)))
end multiplicationTable
end multiplicationTable
Line 613: Line 613:
return lst
return lst
end concatMap
end concatMap



-- enumFromTo :: Int -> Int -> [Int]
-- enumFromTo :: Int -> Int -> [Int]
Line 627: Line 628:
return lst
return lst
end enumFromTo
end enumFromTo



-- foldl :: (a -> b -> a) -> a -> [b] -> a
-- foldl :: (a -> b -> a) -> a -> [b] -> a
Line 639: Line 641:
end tell
end tell
end foldl
end foldl



-- intercalate :: Text -> [Text] -> Text
-- intercalate :: Text -> [Text] -> Text
Line 647: Line 650:
return strJoined
return strJoined
end intercalate
end intercalate



-- justifyRight :: Int -> Char -> Text -> Text
-- justifyRight :: Int -> Char -> Text -> Text
Line 656: Line 660:
end if
end if
end justifyRight
end justifyRight



-- map :: (a -> b) -> [a] -> [b]
-- map :: (a -> b) -> [a] -> [b]
Line 668: Line 673:
end tell
end tell
end map
end map



-- Lift 2nd class handler function into 1st class script wrapper
-- Lift 2nd class handler function into 1st class script wrapper