Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It resembles command language: + is the command, and 1 and 1 are arguments.

  mv foo.txt bar.txt  # rename a file in the Unix shell
Except there are parentheses to delimit the command because commands can be nested in each other.

(Some Lisps have interactive modes where you can drop the outermost parentheses, allowing you to type like this:

  prompt> + 1 1
  2
but usually the parentheses are part of the formal syntax; where this is just a hack in the interactive listener.)

The design choice came about because the syntax started as an internal representation for a symbolic processing (formula manipulation) system that was being designed by John MacCarthy. The internal representation where the operator is first followed by its arguments was convenient because you don't have to parse around to identify them. You know immediately that by accessing the first position of the formula, there is going to be a symbol there which identifies its operator.

The internal form, and its written notation came to be used directly, while the symbol manipulation system came to be programmed in itself, so that its own "formulas" (source code) ended up in that form.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: