Flowcharting. This ancient old practice that's been in use for over 1000 years now, being forced upon us poor students, without any usefulness (or so do I think). It might work well with imperative, sequentially running languages, but what about my beloved functional programming?
Sadly, I'm forced to create a flow chart for my programm (that is written in Haskell).
I imagine it being easy for something like this:
main :: IO ()
main = do
someInput <- getLine
let upped = map toUpper someInput
putStrLn upped
Which is just 3 sequenced steps, fetching data, uppercasing it, outputting it.
Things look worse this time:
main :: IO ()
main = do
someInput <- fmap toUpper getLine
putStrLn someInput
Or like this:
main :: IO ()
main = interact (map toUpper)
Okay, that was IO, you can handle that like an imperative language. What about pure functions?
An actual example:
onlyMatching :: String -> [FilePath] -> [FilePath]
onlyMatching ext = filter f
where f name = lower ('.' : ext) == (lower . takeExtension $ name)
lower = map toLower
How would you flowchart that last one?