Arc Forumnew | comments | leaders | submitlogin
3 points by shader 5011 days ago | link | parent

By printing directly to stdout you don't get to have as many tail calls, but you don't have to worry about much complexity when it comes to aggregating output or adding new functionality. A simple pr is all it takes to add output, and you don't need to worry much about context.

One alternative is functions that take lists as input, and cons in their own output before passing them on to the next level. Then use a final translation function that walks the tree converting it to text using something like the sml parser. Unfortunately this means you have to walk the code twice, once for content generation and once for output transformation.

The pros of the first system are simplicity, efficiency, and compatibility with a socket based web server (just redirect stdout to the socket)

The second system has the advantage of decoupling content from presentation at the cost of complexity managing aggregation, and walking the tree twice.