How to implement a programming language7 (Real-world scenarios)
catDir(pathname) — a function that recursively walks a directory tree and prints the content of every file, except for files starting with a dot.
copyTreeSeq(srcdir, destdir) — a function that recursively copies a directory tree.
copyTree(srcdir, destdir) — the parallel version of the directory copy function. This is much faster because it copies multiple files at once.
In fairness to Node — where I'm writing a
parallelEachabstraction and drop error handling in a (failed) attempt to make the plain NodeJS code look as good as possible.
Exceptions — we show a simple exception system which works across asynchronous calls.