• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why parens aren't like HTML

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote about why parens in LISP aren't like HTML. And then concluded with that they are a bit.

In case I didn't manage to cover all the positions, any more?
 
chris webster
Bartender
Posts: 2407
32
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Slava Akhmechet had a good ramble around this topic a while ago on his defmacro blog, e.g. converting Ant XML tasks into Lispy looking S-expressions, etc.

I had no real problem with the parens thing - much less typing than HTML/XML - and most editors will keep track of them, indent and even colour-code them for you. Anyway, even HTML etc will try to ditch the closing tag if there are no children e.g. <foo blah="bar"></foo> is the same as <foo blah="bar " />.

How are you enjoying the course, by the way?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone in the course posted a link to c2 which has a good discussion on the matter.

I'm liking the course. It is extremely well organized. And they added overlays to the videos to clarify things from the first run.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got permission to cross post my classmate's entire post:

I think the typical comparison of Lisp symbolic expressions (s-exprs) is with XML and not with HTML.

There was a pretty big hullabaloo some years back, just when XML was becoming a buzzword technology, comparing XML to s-exprs. Famously, Erik Naggum's anti-XML rant is always fun to read. The guys over at C2 also have some fairly extensive discussions on this matter.

Interestingly, your defense of closing tags echoes Paul Prescod's defense of XML, the only Pro-XML response I've ever been able to find. Unfortunately the link appears to be broken, and I can't find any mirrors.

My own opinion on the matter is this (just scattered thoughts):
As a programmer, both as a reader and as a writer of code, I've never found parentheses to be a problem. By contrast, the verbosity caused by Lisp's lack of syntax does impact the clarity of code.
A good editor will automatically tell you which parenthesis you are closing, and even automatically indent your code. Losing context is not something I have ever had trouble with.
When working with data, it is a very powerful idea to be able to directly write an in-memory data structure into a human readable structured text document, and then to read it back in again into a format that can be directly manipulated by your language. In Lisp, the idea can be even more powerful since your input file can even be directly processed using the full might of the lisp reader/interpreter. By contrast, I've never found an XML library that didn't leave me cursing its inventors and all of their ancestors. Retrieving data by manipulating an XML DOM or XPath is incredibly clunky and ugly.

EDIT: You can read Paul's article here, courtesy the Wayback Machine.
 
J. Kevin Robbins
Bartender
Posts: 1744
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A warning to those at work. Don't click that "anti-XML rant" link. Our BlueCoat proxy blocked it as a pornographic site.

I'm probably going to get a nasty-gram from corporate security now.
 
Matthew Brown
Bartender
Posts: 4566
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was doing that course, I found the parentheses relatively easy to get used to (with a decent editor, which DrRacket is). And the ability to use [] as well as () (with the interpreter making sure they match) also helped. A bigger step, I found, was getting used to prefix notation. In particular with non-commutative operators.

So, for instance, (+ (a b)) is OK. But I have a really hard time telling my brain that (- (a b)) doesn't have a -a in it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic