Glenn Vanderburg - Cló: The Algorithms of TeX in Clojure
ClojureTV1 HN recommender · recommended in 1 month, 2014–2017
talk · advanced · evergreen · 2014–2017 on HN
Glenn Vanderburg presents Cló, a Clojure library that reimplements TeX's core typesetting algorithms as composable functions. He shows what translating procedural, literate-programming code into functional form teaches.
HN recommends it for its insight into Knuth's TeX algorithms and what changes when they are rewritten functionally.
Up next
9 mo on HNSpec-ulation Keynote - Rich Hickey
ClojureTV
10 HN recommender · 2016–2024
18 mo on HNRuby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
17 HN recommender · 2013–2026
14 mo on HNThe Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
16 HN recommender · 2019–2024
14 mo on HN"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
14 HN recommender · 2022–2026
13 mo on HN"Making Impossible States Impossible" by Richard Feldman
elm-conf
9 HN recommender · 2017–2026
12 mo on HNWilliam Byrd on "The Most Beautiful Program Ever Written" [PWL NYC]
PapersWeLove
11 HN recommender · 2017–2026
11 mo on HNThe Value of Values with Rich Hickey
InfoQ
10 HN recommender · 2014–2023
12 mo on HNWhy Isn't Functional Programming the Norm? – Richard Feldman
Metosin
12 HN recommender · 2019–2025
11 mo on HNMaybe Not - Rich Hickey
ClojureTV
14 HN recommender · 2018–2025
11 mo on HNSolving Problems the Clojure Way - Rafal Dittwald
Clojure/north
10 HN recommender · 2019–2025
10 mo on HNLecture 1A: Overview and Introduction to Lisp
MIT OpenCourseWare
10 HN recommender · 2019–2026
10 mo on HNConway's Game Of Life in APL
Dyalog
11 HN recommender · 2010–2024
3 comments from Hacker News
TL;DR, stack frame all the things. I'm joking (kind of), but I was reminded of this talk about implementing TeX in Clojure [0], in which you are shown the pains Don Knuth took to avoid subroutines calls, ostensibly for performance reasons—such heavy macro usage, for example, that the speaker calls the language a "dialect" of Pascal. Now we have the maxim about programmer cycles versus machine cycles, which is itself getting a little dated because of scale. Anyway, fun times to be in this field. You might also like the "It's 1982 and I can't believe we're still..." part of the talk, (a.k.a. "Everything's amazing and nobody's happy") for putting things into perspective. [0] ▶ this video EDIT Time is on their side though... with tail-call optimization coming to ES6 (just about the only "good part," according to Crockford).
SILE indeed looks great, promising to come on par with the typesetting quality we have come to expect since TeX: Knuth-Plass line breaking, Unicode and OpenType font features support, complete with contextual shaping, Cassowary constraint solver, parallel text, multiple apparati, foot and marginal notes, vertical typesetting… This is a typographer’s dream! But, like TeX and friends (LaTeX, ConTeXt, etc.), creating stylesheets and document templates still looks like a pain with SILE and alike. At least from the perspective of designers who have come to expect a strict separation of concerns between document structure/semantics and its styling, and who are used to work with a declarative stylesheet-based language like the prevalent CSS, as opposed to the macros of TeX, and its document model which conflates semantical markup with inline styling instructions. Similar initiatives like SILE, which attempt to port TeX to newer languages while untangling macro spaghetti, like Cló¹ and Rinohtype², didn’t consider CSS-based stylesheets either. Which is a pity, especially with highly developed W3C Working Draft open standard specifications³ for paged media being out quite some time now. That’s exactly what makes PDF formatters like Prince⁴, which accepts standard html and css as its input, so immensely attractive: users can continue to use the (Web) technologies they already know (html, javascript, css) and enjoy a strict separation of concerns between document contents, templates and
Perhaps Glenn has different goals than you might expect? The video goes into this better than the InfoQ article. In short, I think Glenn embraced the differences and challenges of adapting TeX in Clojure from an educational perspective. I don't think he intended to port it quickly or verbatim. Glenn wanted to head-to-head comparison to promote education. To explain, in Glenn's talk around 11:36 ( ▶ this video ) he says: > While I'm glad that the source code of TeX is still available to study, I sure wouldn't point a new programmer toward it because we should not be doing programs today like we did then. > But what might be really valuable is to have a modern reimplementation written in a modern functional style to study alongside [the original TeX] to see how much has changed and to appreciate what he have and the value of improved tools and techniques and the tradeoffs that have been made. His slide on his educational goals can be seen at 12:06: > Illustrate what's changed > Demonstrate values of expressive code > Provide real examples of expressing procedural algorithms in functional style > Show how functional programs are easier to reason about > Show different styles of optimization