The Roots of Lisp (2002) [pdf]
slackwise.net
slackwise.net
["table", ["tbody", ["tr", ["td class=first", 1], ["td", 2]]]]
instead of: <table><tbody><tr><td class="first">1</td><td>2</td></tr></tbody></table>
A really early attempt at this is: https://github.com/drostie/d.o/blob/master/build.js but I haven't maintained it in a while.If you're interested in language design, there appears to be a "little gap" which means a lot between a Lisp data structure and an XML data structure: In XML's view, every list's first element is a string; in Lisp's, it can be anything. This little gap actually corresponds to one of the interesting habits which has disappeared since compilers took over our assembly-writing: it used to be the case that programmers would sometimes compute an instruction code for the next instruction; similarly in Lisps you sometimes (but not too often; it's confusing!) compute a function for your next operation.
If that confuses you because you're not good with Lisp, it's equivalent in Python or JS is:
(f(x, y, z))(a, b, c)
so that you figure out which function to call and then immediately call it on some parameters. It's not necessarily a difference in expressiveness, as the XML-style just can add an atom 'call' which expresses the above as: call(f(x y z) a b c)
but it does seem to correspond to some deeply different philosophy for the system.Here's a simple template written in Scheme:
(define stuff '("foo" "bar" "baz"))
`(ul (@ (class "foo"))
,@(map (lambda (thing)
`(li ,thing))
stuff))
Output: (ul (@ (class "foo")) (li "foo") (li "bar") (li "baz"))
Fun stuff!You may like Clojure's Hiccup:
https://github.com/weavejester/hiccup
http://www.rkn.io/2014/03/13/clojure-cookbook-hiccup/
These representations underline how anomalous <IMG...>, <BR>, etc are in "standard" HTML.
That said, what could be taught to a young student today that would provide the same kind of enlightenment I had with those few pages of list(p) ?
And that was just the beginning as my university had a few lectures that made use of them, since a few of the major teachers were quite into FP and LP communities.
Then I had to traverse the desert of mainstream languages, until being finally allowed to use such concepts on the programming languages I work with.
In fact, 0 primitive operators suffice, as the ability to denote functions (Section 2) gives us the Turing complete lambda calculus.
A self-interpreter for a version of lambda calculus denoted in binary fits in under 26 bytes, as shown on http://www.cwi.nl/~tromp/cl/cl.html
http://slackwise.net/files/docs/The%20Roots%20of%20Lisp.pdf
The tracking/kerning is still off, but not as much. It's definitely easier to read than the one linked in this post. Anyone know a better utility, or is the source PostScript just poorly typeset?
Edit: I've just applied pkfix[4] to the file as mainland recommended[5], and it looks wonderful! I've replaced the file on my server, so you can Ctrl-F5 it to see the wonderful crisp text.
[1]: http://ghostscript.com/doc/current/Ps2pdf.htm [2]: http://lib.store.yahoo.net/lib/paulgraham/jmc.ps [3]: http://www.paulgraham.com/rootsoflisp.html [4]: http://ctan.mackichan.com/support/pkfix/pkfix.pl [5]: https://news.ycombinator.com/item?id=8350995