"As a general principle, make the program read from top to bottom rather than jumping around. Experts agree that top-to-bottom order contributes most to readability."
I think it's difficult to do it in Wolfram Language. It's not a problem in many other languages, however if a function is not defined, I can't use it in Wolfram Language. Is there any way to do it in Wolfram Language?
For instance,
main[x]
main@x_ := h@g@f[x]
h@x_ := x+1
g@x_ := x+2
f@x_ := x+3
Unfortunately it won't work unless you evaluate the code twice.
I guess not everyone knows the advantages of top-to-bottom structure.
Programs/functions are structured in trees , these trees are top-to-bottom. The top of the tree is the highest level, the bottom of the tree is the lowest level.
When you try to understand a function/program, you can start from the highest level at first. If it's necessary, you can study the lower level until you think you have understood the details you need.
Example in Haskell
build :: XcodeScheme -> IO (EBS String)
build xcodeScheme = createBuildOptionSets xcodeScheme >>>= cleanFrameworks >>>= buildFrameworks >>>= combineFrameworks xcodeScheme
createBuildOptionSets :: XcodeScheme -> IO (Either (BuildError String) [XcodebuildOptionSet])
createBuildOptionSets xcodeScheme = getSupportedPlatforms xcodeScheme >>>= createBuildOptionSets' xcodeScheme
cleanFrameworks :: [XcodebuildOptionSet] -> IO (EBS [XcodebuildOptionSet])
cleanFrameworks optionSets = do
mapM_ cleanFramework optionSets
return $ Right optionSets
buildFrameworks :: [XcodebuildOptionSet] -> IO (EBS ([XcodebuildOptionSet], [FilePath]))
buildFrameworks optionSets = buildFrameworks' optionSets >>= checkBuildResults optionSets
BTW, the quote is from Wolfram Technology Conference. I can do it in the other languages, I just don't know how to do it in Wolfram Language.



main[x]in your haskell example? – Kuba May 29 '17 at 15:39main[x]before definingmain. – WReach May 29 '17 at 16:11