Lisp for Java Users: Complete Reader

Being able to read lists with Symbols is nice, but that definition no longer reads numbers. Here is a version that combines the elements we have shown so far, and adds a couple new ones. The PeekStream now defines a semicolon (;) as a comment character ignoring everything to the end of the current line. The ListReader recognizes Integer, Double and Symbol. It also supports Strings delimited by double quotes. You can put a few special characters into a String using back slash (\) notation. That allows you to type a string with a newline (\n), return (\r), tab (\t) or double quote (\"). Here is the full program with all the additions.

Take a look at the new Symbol class. In addition to the Symbol name, it includes a value that can be changed. We will use this to make Symbols act like variables with values.

Continue to Chapter 2

‚Äč