« BTL: Customer Interaction Points | Main | The Human Element »
XML and Scheme
I put together a small demonstration of how knowing programming language concepts and Scheme can help you understand XML. My point isn’t to show how to do XML inside Scheme or to say Scheme is better than XML. My point is simply to demonstrate that the things my students have been learning in class, which can seem pretty disconnected from things they read about in the trade press, are actually on point. In this case, they see that what they’ve been doing with BNF, s-expressions, and data-driven programming can help them understand XML and how it is processed.
Posted by windley on January 26, 2005 9:04 PM




Comment from Patrick Logan at January 27, 2005 6:50 AM
This is a great excercise to make the connection for your students! A next step that could really blow their minds is to have them try SSAX...
http://ssax.sourceforge.net/
...which essentially "productizes" these concepts of the sexpr/xml duality.
Comment from Harold Carr at January 27, 2005 9:42 AM
The example could be extended with XML attributes. As an old lisper/schemer I've had a hard time accepting the noisyness of XML syntax. So for years I've been using what I call LXML which is identical to what you show plus the addition of an @ sign to handle attributes:
(ulink (@ (url "http://haroldcarr.net")) "Harold Carr")
Transforming this to XML is easy using any dialect of Lisp. I use http://llava.org/ - specifically, llava's org.llava.lib.xml.L2X library.
Comment from Patrick Logan at January 27, 2005 9:52 AM
Harold,
SSAX also uses the @ notation for attributes.
Does it get any better than this for Lisp!
Other languages, bow before your master.
Comment from Harold Carr at January 27, 2005 2:47 PM
Yes, I've always appreciated John Federaro's quote in Paul Graham's preface to _On Lisp_, "Lisp is a programmable programming language." If one loves to program, what could be more fun and productive than programming the language one uses?