Let's Talk Lisp

By Laurent Sillaossy | Go to book overview

6
INTRODUCTION TO MAP FUNCTIONS AND LAMBDA EXPRESSIONS

In the definitions of UNION and INTERSECTION (Sections 5.1.1 and 5.1.2) we went down a list--SET1--taking CDR's, and did something for each element of the list. We shall describe a family of functions, called MAP functions, which separates the bookkeeping involved in going down a list and the process that is applied to the various elements and parts of the list or lists considered. The extensive use of MAP functions, property lists (Chapter 8), and generators (Chapter 7) is the sign of mature LISP programming. This chapter opens the doors of puberty. Ready? Blush!

6.1 MAPCAR

The function MAPCAR is found in many LISP systems. It has two ✓O arguments, a list LIS and a function that is the value of its second argument FUN.

(MAPCAR (LAMBDA (LIS FUN) . . . ) )

MAPCAR goes down LIS and picks up each of the SEXes of LIS. Each SEX in turn is given to the value of FUN, a function of one argument, which is applied to the SEX. The value of MAPCAR is a list of the values of the function (which is the value of FUN and which we shall call the

____________________
In some LISP systems, LIS is the second argument and FUN the first.

-82-

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

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.

Cited page

Let's Talk Lisp

• 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 Reset View mode
Search within

Look up

Look up a word

• Dictionary
• Thesaurus
Please submit a word or phrase above.

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

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.

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.

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.