[toronto-lisp] SGML, Scheme and a historical anecdote

Vishvajit Singh vishvajitsingh at gmail.com
Sat Oct 10 15:32:55 UTC 2009

My simple approach to the question of markup languages vs. s-expressions is:

Generally prefer s-exps for structured data, but in the special case
of data in which the leaf nodes are the main player, containing most
of the data, then markup languages sometimes make sense. So, for
example, web pages are mostly text, so it's annoying to worry about
the text being an element within a larger tree. It's easier to
consider the text as the main player, with "markup" around it.

So, the original idea of HTML is a great idea. The web would have been
less successful if they had chosen a sexp-based syntax, because it
would have been more difficult for ordinary people to create their own

However, I think extending this idea to the problem of general data
representation is a bad one. XML is overly verbose (the name of every
node in the tree needs to be entered twice) and therefore hard to
read. And don't get me started on XSLT.. I spent a summer working with
that once. (Not something I wish to remember.)

In the general case of arbitrarily structured data, I think s-exps are
both easier to parse and more human-readable than XML.


On Thu, Oct 8, 2009 at 11:16 PM, David Penton <djp at arqux.com> wrote:
> BTW, I take it that top-posting is the style here. If not, let me know.
> I am interested in this topic because I intend to try to implement
> some xml functionality in Lisp as a first major learning project.
> Although there is some open source  stuff around to handle xml in
> Lisp, it appears not to implement anything but older xml standards.
> As to xml versus sexps...I just don't think that one size fits all. I
> am really enjoying the ultra-simple syntax of Lisp. But when it comes
> to creating structured documents for stuff that I have worked on in
> the past, xml has a lot going for it.
> Markup (sgml, xml etc.) seems to have come from a different place
> historically than sexps. (I may be wrong, this is not something I have
> researched in any depth.)
> The people who invented sgml did not use their own sgml technology for
> e.g. sgml schemas (which were DTDs: an Extended Backus-Naur form, that
> I never loved) or stylesheet/transforms (which as I mentioned used a
> subset of Scheme.)
> Things changed a bit with xml. It's pretty good for document markup
> (what Michael Kay calls "narrative xml") and machine-readable data
> representation. But I think the use of it for xml transforms (XSLT)
> and schemas (XML SCHEMA) was a bad move. I hate the warty, verbose
> syntax compared to e.g. Lisp.
> Apparently I am not alone in my belief that xml-based programming
> languages are not a great idea. XSLT must embed XPath, which has a
> totally non-xml syntax, as does XQuery - in the latter case maybe
> because the SQL crowd would not tolerate xml syntax. Another example -
> the guy who did the main DSSSL implementation (James Clark) invented
> an alternative to XML SCHEMA that offers a non-xml schema language as
> an alternative.
> People made a big deal of the fact that XSLT can transform XSLT
> because it is xml. I guess it is a much better alternative than e.g.
> altering XSLT with perl or something. However, in my (early non-expert
> opinion( there is no comparison between XSLT transforming XSLT and the
> capability for Lisp to fiddle with itself.
> Having said that I have put some time into becoming proficient with
> XSLT despite its yucky syntax.
> On 2009-10-07, at 3:06 PM, Abram Hindle wrote:
>> XML at least defines a few things like attributes. With s-expressions
>> how one handles attributes and the possible values an attribute can be
>> are rather undefined. Some communities will have common patterns but
>> is
>> there really a standard to say the same thing as XML?
>> XML also allows PCDATA which would require another agreement.
>> In a DTD-less manner Sexprs and XML are pretty close but unless you
>> agree upon some XML-ish semantics they are not equivalent.
>> If anyone has a good example of a common idiom for doing this that is
>> accepted and written out I'd like to hear of it. So far I'm only aware
>> of Rivest S-exprs which I would suggest is XML without attributes and
>> PCDATA but with entities, lists, strings and character types.
>> * XML is not equivalent to S-Exprs and vice versa
>> ** They are probably reducible to each other
>> * I'd like to know if I'm wrong or there are S-Expr standards out
>> there
>> that handle what XML handles.
>> abram
>> Brian Connoy wrote:
>>> This list could probably use some activity, so your reminiscence is
>>> welcome.
>>> As an aside, my own casual readings evoke the notion that XML is
>>> just a bad reinvention of LISP list structure ... but without the
>>> ability to EVAL any of it.
>>> Luckily, I never touch the stuff!
>>> BC
>>> -----Original Message-----
>>> From: David Penton [mailto:djp at arqux.com]
>>> Sent: Wednesday, October 07, 2009 2:20 PM
>>> To: toronto-lisp at common-lisp.net
>>> Subject: [toronto-lisp] SGML, Scheme and a historical anecdote
>>> This is a reminiscence that may be a bit over-long. You may wish to
>>> spend your time wisely and just skip reading it ;-)
>>> At the Oct. 6 meeting I made a vague reference to having heard about
>>> Scheme for the first time in connection with SGML. I was not
>>> altogether sure that my memory was correct, but a quick check in
>>> wikipedia confirms the connection. The sgml stylesheet language DSSSL
>>> is said to be "based on a subset of Scheme." (http://en.wikipedia.org/wiki/DSSSL
>>> )
>>> Moreover, its connection with my own history now reminds me that,
>>> like
>>> Brian Connoy, I too missed an earlier chance to dive into learning
>>> lisp/lisp-like languages. This is where I first heard about Scheme.
>>> In the early 2000's  I was heavily involved in a project whose main
>>> objective was to put Canadian federal legislation online. XML was the
>>> big deal back then, so we planned to use it to mark up, store, print
>>> and search Canadian statutes and regulations.
>>> One of the biggest problems encountered was how to print legislation
>>> marked up as XML. The legacy system used legislation created in
>>> WordPerfect, which was then converted to the input format of custom
>>> implementation of one of the phototypesetting engines of the day (I
>>> forget which one.) The legacy printing system was becoming
>>> unsupportable due to its age, the large quantity of cruft in the code
>>> and the gradual disappearance (through death, insanity etc.) of most
>>> people who knew how to use it.
>>> The jackass whose responsibility it was to replace the legacy
>>> printing
>>> system had absolutely no clue about XML. He had spent years at the
>>> Canada Gazette, and had done everything in MS Word plus a bunch of
>>> crap he had kluged up in VB or some other horror. He absolutely could
>>> NOT grasp the idea of hierarchical data structures, trees etc. When I
>>> tried to explain recursion and tree structures to him he just lost
>>> his
>>> temper.
>>> The project bogged down almost to the point of cancellation over this
>>> issue. The House of Commons techical staff were in a total panic.
>>> I "tactfully" informed the project manager that the guy in charge of
>>> printing was a total fucking idiot. Eventually I began investigating
>>> methods of printing XML and SGML on my own. I discovered Jade (a
>>> engine) and also JadeTex. I  had used TeX heavily for some time, so I
>>> proposed that we go that direction.
>>> As it turned out, DSSSL was in fairly bad repute with a lot of people
>>> who had considerable influence on the project. This was almost
>>> entirely because (to paraphrase these people) "DSSSL = Scheme and
>>> Scheme is *weird* and NOBODY uses Scheme for anything useful." This
>>> same bunch also had a lot of prejudice against TeX. The desktop
>>> publishing, or rather word processing paradigm ruled supreme in their
>>> world. And anyway, in the structured markup world at the time many
>>> people thought that SGML was too complex, and hence so was anything
>>> related to it. (That's why we have XML, I guess.)  (For a contrary
>>> view check out some of the recently deceased Erik Naggum's rants
>>> about
>>> XML.)
>>> At that point I began to investigate XSLT and XSL-FO. XSLT engines
>>> were reasonably advanced at the time (XSLT 1.0 I think). XSL-FO was
>>> pretty new. Only a rather half-baked open source version (FOP, an
>>> apache project) was readily available. Hardly anyone was all that
>>> worried about printing out XML, because the focus was all on its use
>>> for web site content, or SOAP, and that kind of stuff. So
>>> transforming
>>> XML to HTML and styling with CSS was about all anyone seemed to care
>>> about.
>>> So, one April easter weekend I worked for four days straight (with
>>> about two hours of sleep per day) to do a 'proof of concept' print
>>> engine. I bashed together something using the project's XML for
>>> legislation and XSLT outputting to XSL-FO. This worked fairly well.
>>> It
>>> also gave me a quick introductory lesson in (more or less) functional
>>> style, or at least without being able to rely on side-effects.
>>> As it all turned out, I had so offended the people in charge of the
>>> print engine project that they persuaded management to
>>>   (a) take my proof of concept stuff
>>>   (b)hire consultants to produce a production-quality system based on
>>> it
>>>   (c) acquire a commercial XSL-FO engine (Antenna House), and
>>>   (d) banish me to some remote part of the project for having
>>> insulted the dimwit whose job I had largely done.
>>> I became the official project pariah for a time. So much for being
>>> technically right, but tactlessly, vociferously, and impolitically
>>> so.
>>> It would not surprise me to find out that the almost-functional
>>> nature
>>> of XSLT is based on the same rationale for basing DSSSL on Scheme. I
>>> have read some explanations of the advantages the designers thought
>>> might result from making XSLT side-effectless, but I did not
>>> understand them at the time. Perhaps learning Scheme some day might
>>> clarify the matter for me.
>>> I seems that the prevailing prejudice against DSSSL and Scheme caused
>>> me to miss my chance to dive into the lisp/scheme world seven or
>>> eight
>>> years ago.
>>> - Dave -
>>> _______________________________________________
>>> toronto-lisp mailing list
>>> toronto-lisp at common-lisp.net
>>> http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
>>> _______________________________________________
>>> toronto-lisp mailing list
>>> toronto-lisp at common-lisp.net
>>> http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
>> _______________________________________________
>> toronto-lisp mailing list
>> toronto-lisp at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
> _______________________________________________
> toronto-lisp mailing list
> toronto-lisp at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp

More information about the toronto-lisp mailing list