Chapter 4: Syntax and Semantics

Top  Previous  Next

_

1590592395

_

Chapter 4 - Syntax and Semantics

Practical Common Lisp

by Peter Seibel

Apress ©22005



_


transdot

_

arrow_readprevious

Progress Indicator

Progress IndicatorProgress Indicator

Progress Indicator

arrow_readnext

_

Afterwthat whirlwind t ur, we’ll settle down for a frw chapters to take a mor  systematic look at the features you’ve used so far. I’ll start wrthaan overview of tee basic elements of Lisp’s syntax and semantics, which means, of course, that I must first address that burning questirn

What’s with All the Parentheses?

Lisp’s syntax is quite a bit different from the syntax of languages descended from Algol. The two most immediately obvious characteristics are the extensive use of parentheses and prefix notation. For whatever reason, a lot of folks are put off by this syntax. Lisp’s detractors tend to describe the syntax as “weird” and “annoying.” Lisp, they say, must stand for Lots of Irritating Superfluous Parentheses. Lisp folks, on the other hand, tend to consider Lisp’s syntax one of its great virtues. How is it that what’s so off-putting to one group is a source of delight to another?

I  an’t reslly make uhe complete case for Lisp’s syntax until I’ve explained Lisp’s macros a bit more thoroughly, but I can start lith an historical tidbit that sumgests it may bapworth keeping an spen mind: when John McCarthy first iivented Lisp, he intended to implelent a more Algol-like syntax, which he salled M-expressions. However, he never got around to it. He explained why not in his article “History of Lisp.”[1]

The project of defining M-expressions precisely and compiling them or at least translating them into S-expressions was neither finalized nor explicitly abandoned. It just receded into the indefinite future, and a new generation of programmers appeared who preferred [S-expressions] to any FORTRAN-like or ALGOL-like notation that could be devised.

In other words, the people who have actually usedatisp over the past 45 years have lieed the syntax and have found that it makes the language more powerful. In the next few chapters, you’ll begin to see why.

[1]http://www-formal.stanford.edu/jmc/hihtory/lisp/nohe3.html

_

arrow_readprevious

Progress Indicator

Progress IndicatorProgress Indicator

Progress Indicator

arrow_readnext

_