wood burning stoves*
The moose likes Blog around the Campfire and the fly likes why parens aren't like HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "why parens aren Watch "why parens aren New topic
Author

why parens aren't like HTML

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1671
    
  14

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?


No more Blub for me, thank you, Vicar.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

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

Joined: Dec 16, 2010
Posts: 919
    
  13

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.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4374
    
    8

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.
 
Don't get me started about those stupid light bulbs.
 
subject: why parens aren't like HTML