appendix A
COUNTING PARENTHESES
It is so easy to miscount parentheses, thereby becoming unintelligible in LISP, that we shall describe three different algorithms to count parentheses. Personal taste will dictate the preferred one.Let us consider a hard example of a list: Is ((A (B (C) (D))) ((E) (((E))) ((E)))) a list? A quick inspection is not conclusive. We must start counting parentheses. The following methods will work.
A.1 PARENCOUNT1
Scan the expression from left to right, and use a counter for the parentheses. The counter, initially zero, is increased by I for each left parenthesis encountered and is decreased by I for each right parenthesis encountered. Our example yields the following count:

((A (B (C) (D))) ((E) (((E))) ((E))))

012 3 4 3 4 321 23 2 345 432 3 4 3210

It is most important to be aware that we have a list if and only if both the following conditions hold:
a. The counter is 0 on the last parenthesis. Otherwise the number of right and left parentheses is not the same.
b. The counter is 0 only on the last parenthesis. Otherwise there may be

-214-

Notes for this page

Add a new note
If you are trying to select text to create highlights or citations, remember that you must now click or tap on the first word, and then click or tap on the last word.
One moment ...
Default project is now your active project.
Project items
Notes
Cite this page

Cited page

Style
Citations are available only to our active members.
Buy instant access to cite pages or passages in MLA 8, MLA 7, APA and Chicago citation styles.

(Einhorn, 1992, p. 25)

(Einhorn 25)

(Einhorn 25)

1. Lois J. Einhorn, Abraham Lincoln, the Orator: Penetrating the Lincoln Legend (Westport, CT: Greenwood Press, 1992), 25, http://www.questia.com/read/27419298.

Note: primary sources have slightly different requirements for citation. Please see these guidelines for more information.

Cited page

Bookmark this page
Let's Talk Lisp
Table of contents

Table of contents

  • Title Page iii
  • Contents v
  • Preface xiii
  • 1 - A Language for the Computer 1
  • 2 - Elementary Sentences 6
  • 3 - Elementary Define 24
  • 4 - Elementary Recursive Define 31
  • 5 - Addmonal Recursive Definitions 51
  • 6 - Introduction to Map Functions and Lambda Expressions 82
  • 7 - Prog, Constants and Generators 96
  • 8 - Property Lists 114
  • 9 - The Lisp Interpreter Eval 128
  • 10 - Lisp Storage Structures 136
  • 11 - Miscellaneous Functions and Features 160
  • 12 - Some Larger Examples 169
  • Appendix A - Counting Parentheses 214
  • Appendix B - Quickie Introduction to Lisp for Experienced Programmers 217
  • Appendix C 224
  • A Lisp Bibliography 224
  • Appendix D - Some Errors in Lisp Programs 226
  • Index 235
Settings

Settings

Typeface
Text size Smaller Larger Reset View mode
Search within

Search within this book

Look up

Look up a word

  • Dictionary
  • Thesaurus
Please submit a word or phrase above.
Print this page

Print this page

Why can't I print more than one page at a time?

Help
Full screen
Items saved from this book
  • Bookmarks
  • Highlights & Notes
  • Citations
/ 240

matching results for page

    Questia reader help

    How to highlight and cite specific passages

    1. Click or tap the first word you want to select.
    2. Click or tap the last word you want to select, and you’ll see everything in between get selected.
    3. You’ll then get a menu of options like creating a highlight or a citation from that passage of text.

    OK, got it!

    Cited passage

    Style
    Citations are available only to our active members.
    Buy instant access to cite pages or passages in MLA 8, MLA 7, APA and Chicago citation styles.

    "Portraying himself as an honest, ordinary person helped Lincoln identify with his audiences." (Einhorn, 1992, p. 25).

    "Portraying himself as an honest, ordinary person helped Lincoln identify with his audiences." (Einhorn 25)

    "Portraying himself as an honest, ordinary person helped Lincoln identify with his audiences." (Einhorn 25)

    "Portraying himself as an honest, ordinary person helped Lincoln identify with his audiences."1

    1. Lois J. Einhorn, Abraham Lincoln, the Orator: Penetrating the Lincoln Legend (Westport, CT: Greenwood Press, 1992), 25, http://www.questia.com/read/27419298.

    Cited passage

    Thanks for trying Questia!

    Please continue trying out our research tools, but please note, full functionality is available only to our active members.

    Your work will be lost once you leave this Web page.

    Buy instant access to save your work.

    Already a member? Log in now.

    Search by... Author
    Show... All Results Primary Sources Peer-reviewed

    Oops!

    An unknown error has occurred. Please click the button below to reload the page. If the problem persists, please try again in a little while.