home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / schmrprt / r399rs.lha / basic.tex < prev    next >
LaTeX Document  |  1989-08-31  |  8.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 5c 76 66 69 6c 6c 5c | 65 6a 65 63 74 0a 5c 63 |%\vfill\|eject.\c|
|00000010| 68 61 70 74 65 72 7b 42 | 61 73 69 63 20 63 6f 6e |hapter{B|asic con|
|00000020| 63 65 70 74 73 7d 0a 5c | 6c 61 62 65 6c 7b 62 61 |cepts}.\|label{ba|
|00000030| 73 69 63 63 68 61 70 74 | 65 72 7d 0a 0a 5c 73 65 |sicchapt|er}..\se|
|00000040| 63 74 69 6f 6e 7b 56 61 | 72 69 61 62 6c 65 73 20 |ction{Va|riables |
|00000050| 61 6e 64 20 72 65 67 69 | 6f 6e 73 7d 0a 5c 6c 61 |and regi|ons}.\la|
|00000060| 62 65 6c 7b 73 70 65 63 | 69 61 6c 66 6f 72 6d 73 |bel{spec|ialforms|
|00000070| 65 63 74 69 6f 6e 7d 0a | 5c 6c 61 62 65 6c 7b 76 |ection}.|\label{v|
|00000080| 61 72 69 61 62 6c 65 73 | 65 63 74 69 6f 6e 7d 0a |ariables|ection}.|
|00000090| 0a 41 6e 79 20 69 64 65 | 6e 74 69 66 69 65 72 20 |.Any ide|ntifier |
|000000a0| 74 68 61 74 20 69 73 20 | 6e 6f 74 20 61 20 73 79 |that is |not a sy|
|000000b0| 6e 74 61 63 74 69 63 20 | 6b 65 79 77 6f 72 64 5c |ntactic |keyword\|
|000000c0| 69 6e 64 65 78 7b 6b 65 | 79 77 6f 72 64 7d 20 28 |index{ke|yword} (|
|000000d0| 73 65 65 0a 73 65 63 74 | 69 6f 6e 7e 5c 72 65 66 |see.sect|ion~\ref|
|000000e0| 7b 6b 65 79 77 6f 72 64 | 73 65 63 74 69 6f 6e 7d |{keyword|section}|
|000000f0| 29 20 6d 61 79 20 62 65 | 20 75 73 65 64 20 61 73 |) may be| used as|
|00000100| 20 61 20 76 61 72 69 61 | 62 6c 65 2e 5c 69 6e 64 | a varia|ble.\ind|
|00000110| 65 78 7b 73 79 6e 74 61 | 63 74 69 63 0a 6b 65 79 |ex{synta|ctic.key|
|00000120| 77 6f 72 64 7d 5c 69 6e | 64 65 78 7b 69 64 65 6e |word}\in|dex{iden|
|00000130| 74 69 66 69 65 72 7d 5c | 6d 61 69 6e 69 6e 64 65 |tifier}\|maininde|
|00000140| 78 7b 76 61 72 69 61 62 | 6c 65 7d 20 20 41 20 76 |x{variab|le} A v|
|00000150| 61 72 69 61 62 6c 65 20 | 6d 61 79 20 6e 61 6d 65 |ariable |may name|
|00000160| 20 61 0a 6c 6f 63 61 74 | 69 6f 6e 20 77 68 65 72 | a.locat|ion wher|
|00000170| 65 20 61 20 76 61 6c 75 | 65 20 63 61 6e 20 62 65 |e a valu|e can be|
|00000180| 20 73 74 6f 72 65 64 2e | 20 20 41 20 76 61 72 69 | stored.| A vari|
|00000190| 61 62 6c 65 20 74 68 61 | 74 20 64 6f 65 73 20 73 |able tha|t does s|
|000001a0| 6f 20 69 73 20 73 61 69 | 64 0a 74 6f 20 62 65 20 |o is sai|d.to be |
|000001b0| 7b 5c 65 6d 20 62 6f 75 | 6e 64 7d 20 74 6f 20 74 |{\em bou|nd} to t|
|000001c0| 68 65 20 6c 6f 63 61 74 | 69 6f 6e 2e 20 20 54 68 |he locat|ion. Th|
|000001d0| 65 20 73 65 74 20 6f 66 | 20 61 6c 6c 20 76 69 73 |e set of| all vis|
|000001e0| 69 62 6c 65 0a 62 69 6e | 64 69 6e 67 73 5c 6d 61 |ible.bin|dings\ma|
|000001f0| 69 6e 69 6e 64 65 78 7b | 62 69 6e 64 69 6e 67 7d |inindex{|binding}|
|00000200| 20 69 6e 20 65 66 66 65 | 63 74 20 61 74 20 73 6f | in effe|ct at so|
|00000210| 6d 65 20 70 6f 69 6e 74 | 20 69 6e 20 61 20 70 72 |me point| in a pr|
|00000220| 6f 67 72 61 6d 20 69 73 | 0a 6b 6e 6f 77 6e 20 61 |ogram is|.known a|
|00000230| 73 20 74 68 65 20 7b 5c | 65 6d 20 65 6e 76 69 72 |s the {\|em envir|
|00000240| 6f 6e 6d 65 6e 74 7d 20 | 69 6e 20 65 66 66 65 63 |onment} |in effec|
|00000250| 74 20 61 74 20 74 68 61 | 74 20 70 6f 69 6e 74 2e |t at tha|t point.|
|00000260| 20 20 54 68 65 20 76 61 | 6c 75 65 0a 73 74 6f 72 | The va|lue.stor|
|00000270| 65 64 20 69 6e 20 74 68 | 65 20 6c 6f 63 61 74 69 |ed in th|e locati|
|00000280| 6f 6e 20 74 6f 20 77 68 | 69 63 68 20 61 20 76 61 |on to wh|ich a va|
|00000290| 72 69 61 62 6c 65 20 69 | 73 20 62 6f 75 6e 64 20 |riable i|s bound |
|000002a0| 69 73 20 63 61 6c 6c 65 | 64 20 74 68 65 0a 76 61 |is calle|d the.va|
|000002b0| 72 69 61 62 6c 65 27 73 | 20 76 61 6c 75 65 2e 20 |riable's| value. |
|000002c0| 20 42 79 20 61 62 75 73 | 65 20 6f 66 20 74 65 72 | By abus|e of ter|
|000002d0| 6d 69 6e 6f 6c 6f 67 79 | 2c 20 74 68 65 20 76 61 |minology|, the va|
|000002e0| 72 69 61 62 6c 65 20 69 | 73 20 73 6f 6d 65 74 69 |riable i|s someti|
|000002f0| 6d 65 73 0a 73 61 69 64 | 20 74 6f 20 6e 61 6d 65 |mes.said| to name|
|00000300| 20 74 68 65 20 76 61 6c | 75 65 20 6f 72 20 74 6f | the val|ue or to|
|00000310| 20 62 65 20 62 6f 75 6e | 64 20 74 6f 20 74 68 65 | be boun|d to the|
|00000320| 20 76 61 6c 75 65 2e 20 | 20 54 68 69 73 20 69 73 | value. | This is|
|00000330| 20 6e 6f 74 20 71 75 69 | 74 65 0a 61 63 63 75 72 | not qui|te.accur|
|00000340| 61 74 65 2c 20 62 75 74 | 20 63 6f 6e 66 75 73 69 |ate, but| confusi|
|00000350| 6f 6e 20 72 61 72 65 6c | 79 20 72 65 73 75 6c 74 |on rarel|y result|
|00000360| 73 20 66 72 6f 6d 20 74 | 68 69 73 20 70 72 61 63 |s from t|his prac|
|00000370| 74 69 63 65 2e 0a 0a 5c | 74 6f 64 6f 7b 44 65 66 |tice...\|todo{Def|
|00000380| 69 6e 65 20 60 60 61 73 | 73 69 67 6e 65 64 27 27 |ine ``as|signed''|
|00000390| 20 61 6e 64 20 60 60 75 | 6e 61 73 73 69 67 6e 65 | and ``u|nassigne|
|000003a0| 64 27 27 20 70 65 72 68 | 61 70 73 3f 7d 0a 0a 5c |d'' perh|aps?}..\|
|000003b0| 74 6f 64 6f 7b 49 6e 20 | 70 72 6f 67 72 61 6d 73 |todo{In |programs|
|000003c0| 20 77 69 74 68 6f 75 74 | 20 73 69 64 65 20 65 66 | without| side ef|
|000003d0| 66 65 63 74 73 2c 20 6f | 6e 65 20 63 61 6e 20 73 |fects, o|ne can s|
|000003e0| 61 66 65 6c 79 20 70 72 | 65 74 65 6e 64 20 74 68 |afely pr|etend th|
|000003f0| 61 74 20 74 68 65 0a 76 | 61 72 69 61 62 6c 65 73 |at the.v|ariables|
|00000400| 20 61 72 65 20 62 6f 75 | 6e 64 20 64 69 72 65 63 | are bou|nd direc|
|00000410| 74 6c 79 20 74 6f 20 74 | 68 65 20 61 72 67 75 6d |tly to t|he argum|
|00000420| 65 6e 74 73 2e 20 20 4f | 72 3a 0a 49 6e 20 70 72 |ents. O|r:.In pr|
|00000430| 6f 67 72 61 6d 73 20 77 | 69 74 68 6f 75 74 20 5c |ograms w|ithout \|
|00000440| 69 64 65 7b 73 65 74 21 | 7d 2c 20 6f 6e 65 20 63 |ide{set!|}, one c|
|00000450| 61 6e 20 73 61 66 65 6c | 79 20 70 72 65 74 65 6e |an safel|y preten|
|00000460| 64 20 74 68 61 74 20 74 | 68 65 0a 76 61 72 69 61 |d that t|he.varia|
|00000470| 62 6c 65 20 69 73 20 62 | 6f 75 6e 64 20 64 69 72 |ble is b|ound dir|
|00000480| 65 63 74 6c 79 20 74 6f | 20 74 68 65 20 76 61 6c |ectly to| the val|
|00000490| 75 65 2e 20 7d 0a 0a 5c | 76 65 73 74 20 43 65 72 |ue. }..\|vest Cer|
|000004a0| 74 61 69 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |tain exp|ression |
|000004b0| 74 79 70 65 73 20 61 72 | 65 20 75 73 65 64 20 74 |types ar|e used t|
|000004c0| 6f 20 63 72 65 61 74 65 | 20 6e 65 77 20 6c 6f 63 |o create| new loc|
|000004d0| 61 74 69 6f 6e 73 20 61 | 6e 64 20 74 6f 0a 62 69 |ations a|nd to.bi|
|000004e0| 6e 64 20 76 61 72 69 61 | 62 6c 65 73 20 74 6f 20 |nd varia|bles to |
|000004f0| 74 68 6f 73 65 20 6c 6f | 63 61 74 69 6f 6e 73 2e |those lo|cations.|
|00000500| 20 20 54 68 65 20 6d 6f | 73 74 20 66 75 6e 64 61 | The mo|st funda|
|00000510| 6d 65 6e 74 61 6c 20 6f | 66 20 74 68 65 73 65 20 |mental o|f these |
|00000520| 7b 5c 65 6d 0a 62 69 6e | 64 69 6e 67 20 63 6f 6e |{\em.bin|ding con|
|00000530| 73 74 72 75 63 74 73 7d | 5c 6d 61 69 6e 69 6e 64 |structs}|\mainind|
|00000540| 65 78 7b 62 69 6e 64 69 | 6e 67 20 63 6f 6e 73 74 |ex{bindi|ng const|
|00000550| 72 75 63 74 7d 20 69 73 | 20 74 68 65 0a 5c 6c 61 |ruct} is| the.\la|
|00000560| 6d 62 64 61 65 78 70 7b | 7d 5c 69 6e 64 65 78 7b |mbdaexp{|}\index{|
|00000570| 5c 6c 61 6d 62 64 61 65 | 78 70 7b 7d 7d 2c 20 62 |\lambdae|xp{}}, b|
|00000580| 65 63 61 75 73 65 20 61 | 6c 6c 20 6f 74 68 65 72 |ecause a|ll other|
|00000590| 20 62 69 6e 64 69 6e 67 | 20 63 6f 6e 73 74 72 75 | binding| constru|
|000005a0| 63 74 73 0a 63 61 6e 20 | 62 65 20 65 78 70 6c 61 |cts.can |be expla|
|000005b0| 69 6e 65 64 20 69 6e 20 | 74 65 72 6d 73 20 6f 66 |ined in |terms of|
|000005c0| 20 5c 6c 61 6d 62 64 61 | 65 78 70 7b 7d 73 2e 20 | \lambda|exp{}s. |
|000005d0| 20 54 68 65 20 6f 74 68 | 65 72 20 62 69 6e 64 69 | The oth|er bindi|
|000005e0| 6e 67 0a 63 6f 6e 73 74 | 72 75 63 74 73 20 61 72 |ng.const|ructs ar|
|000005f0| 65 20 5c 69 64 65 7b 6c | 65 74 7d 2c 20 5c 69 64 |e \ide{l|et}, \id|
|00000600| 65 7b 6c 65 74 2a 7d 2c | 20 5c 69 64 65 7b 6c 65 |e{let*},| \ide{le|
|00000610| 74 72 65 63 7d 2c 20 61 | 6e 64 20 5c 69 64 65 7b |trec}, a|nd \ide{|
|00000620| 64 6f 7d 0a 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |do}.expr|essions |
|00000630| 28 73 65 65 20 73 65 63 | 74 69 6f 6e 73 7e 5c 72 |(see sec|tions~\r|
|00000640| 65 66 7b 6c 61 6d 62 64 | 61 7d 2c 20 5c 72 65 66 |ef{lambd|a}, \ref|
|00000650| 7b 6c 65 74 72 65 63 7d | 2c 20 61 6e 64 20 5c 72 |{letrec}|, and \r|
|00000660| 65 66 7b 64 6f 7d 29 2e | 0a 0a 25 4e 6f 74 65 3a |ef{do}).|..%Note:|
|00000670| 20 69 6e 74 65 72 6e 61 | 6c 20 64 65 66 69 6e 69 | interna|l defini|
|00000680| 74 69 6f 6e 73 20 6e 6f | 74 20 6d 65 6e 74 69 6f |tions no|t mentio|
|00000690| 6e 65 64 20 68 65 72 65 | 2e 0a 0a 5c 76 65 73 74 |ned here|...\vest|
|000006a0| 20 4c 69 6b 65 20 41 6c | 67 6f 6c 20 61 6e 64 20 | Like Al|gol and |
|000006b0| 50 61 73 63 61 6c 2c 20 | 61 6e 64 20 75 6e 6c 69 |Pascal, |and unli|
|000006c0| 6b 65 20 6d 6f 73 74 20 | 6f 74 68 65 72 20 64 69 |ke most |other di|
|000006d0| 61 6c 65 63 74 73 20 6f | 66 20 4c 69 73 70 0a 65 |alects o|f Lisp.e|
|000006e0| 78 63 65 70 74 20 66 6f | 72 20 43 6f 6d 6d 6f 6e |xcept fo|r Common|
|000006f0| 20 4c 69 73 70 2c 20 53 | 63 68 65 6d 65 20 69 73 | Lisp, S|cheme is|
|00000700| 20 61 20 73 74 61 74 69 | 63 61 6c 6c 79 20 73 63 | a stati|cally sc|
|00000710| 6f 70 65 64 20 6c 61 6e | 67 75 61 67 65 20 77 69 |oped lan|guage wi|
|00000720| 74 68 0a 62 6c 6f 63 6b | 20 73 74 72 75 63 74 75 |th.block| structu|
|00000730| 72 65 2e 20 20 54 6f 20 | 65 61 63 68 20 70 6c 61 |re. To |each pla|
|00000740| 63 65 20 77 68 65 72 65 | 20 61 20 76 61 72 69 61 |ce where| a varia|
|00000750| 62 6c 65 20 69 73 20 62 | 6f 75 6e 64 20 69 6e 20 |ble is b|ound in |
|00000760| 61 20 70 72 6f 67 72 61 | 6d 0a 74 68 65 72 65 20 |a progra|m.there |
|00000770| 63 6f 72 72 65 73 70 6f | 6e 64 73 20 61 20 5c 64 |correspo|nds a \d|
|00000780| 65 66 69 6e 69 6e 67 7b | 72 65 67 69 6f 6e 7d 20 |efining{|region} |
|00000790| 6f 66 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 74 |of the p|rogram t|
|000007a0| 65 78 74 20 77 69 74 68 | 69 6e 20 77 68 69 63 68 |ext with|in which|
|000007b0| 0a 74 68 65 20 62 69 6e | 64 69 6e 67 20 69 73 20 |.the bin|ding is |
|000007c0| 65 66 66 65 63 74 69 76 | 65 2e 20 20 54 68 65 20 |effectiv|e. The |
|000007d0| 72 65 67 69 6f 6e 20 69 | 73 20 64 65 74 65 72 6d |region i|s determ|
|000007e0| 69 6e 65 64 20 62 79 20 | 74 68 65 20 70 61 72 74 |ined by |the part|
|000007f0| 69 63 75 6c 61 72 0a 62 | 69 6e 64 69 6e 67 20 63 |icular.b|inding c|
|00000800| 6f 6e 73 74 72 75 63 74 | 20 74 68 61 74 20 65 73 |onstruct| that es|
|00000810| 74 61 62 6c 69 73 68 65 | 73 20 74 68 65 20 62 69 |tablishe|s the bi|
|00000820| 6e 64 69 6e 67 3b 20 69 | 66 20 74 68 65 20 62 69 |nding; i|f the bi|
|00000830| 6e 64 69 6e 67 20 69 73 | 0a 65 73 74 61 62 6c 69 |nding is|.establi|
|00000840| 73 68 65 64 20 62 79 20 | 61 20 5c 6c 61 6d 62 64 |shed by |a \lambd|
|00000850| 61 65 78 70 7b 7d 2c 20 | 66 6f 72 20 65 78 61 6d |aexp{}, |for exam|
|00000860| 70 6c 65 2c 20 74 68 65 | 6e 20 69 74 73 20 72 65 |ple, the|n its re|
|00000870| 67 69 6f 6e 0a 69 73 20 | 74 68 65 20 65 6e 74 69 |gion.is |the enti|
|00000880| 72 65 20 5c 6c 61 6d 62 | 64 61 65 78 70 7b 7d 2e |re \lamb|daexp{}.|
|00000890| 20 20 45 76 65 72 79 20 | 72 65 66 65 72 65 6e 63 | Every |referenc|
|000008a0| 65 20 74 6f 20 6f 72 20 | 61 73 73 69 67 6e 6d 65 |e to or |assignme|
|000008b0| 6e 74 20 6f 66 20 61 0a | 76 61 72 69 61 62 6c 65 |nt of a.|variable|
|000008c0| 20 72 65 66 65 72 73 20 | 74 6f 20 74 68 65 20 62 | refers |to the b|
|000008d0| 69 6e 64 69 6e 67 20 6f | 66 20 74 68 65 20 76 61 |inding o|f the va|
|000008e0| 72 69 61 62 6c 65 20 74 | 68 61 74 20 65 73 74 61 |riable t|hat esta|
|000008f0| 62 6c 69 73 68 65 64 20 | 74 68 65 0a 69 6e 6e 65 |blished |the.inne|
|00000900| 72 6d 6f 73 74 20 6f 66 | 20 74 68 65 20 72 65 67 |rmost of| the reg|
|00000910| 69 6f 6e 73 20 63 6f 6e | 74 61 69 6e 69 6e 67 20 |ions con|taining |
|00000920| 74 68 65 20 75 73 65 2e | 20 20 49 66 20 74 68 65 |the use.| If the|
|00000930| 72 65 20 69 73 20 6e 6f | 20 62 69 6e 64 69 6e 67 |re is no| binding|
|00000940| 20 6f 66 0a 74 68 65 20 | 76 61 72 69 61 62 6c 65 | of.the |variable|
|00000950| 20 77 68 6f 73 65 20 72 | 65 67 69 6f 6e 20 63 6f | whose r|egion co|
|00000960| 6e 74 61 69 6e 73 20 74 | 68 65 20 75 73 65 2c 20 |ntains t|he use, |
|00000970| 74 68 65 6e 20 74 68 65 | 20 75 73 65 20 72 65 66 |then the| use ref|
|00000980| 65 72 73 20 74 6f 20 74 | 68 65 0a 62 69 6e 64 69 |ers to t|he.bindi|
|00000990| 6e 67 20 66 6f 72 20 74 | 68 65 20 76 61 72 69 61 |ng for t|he varia|
|000009a0| 62 6c 65 20 69 6e 20 74 | 68 65 20 74 6f 70 20 6c |ble in t|he top l|
|000009b0| 65 76 65 6c 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |evel env|ironment|
|000009c0| 2c 20 69 66 20 61 6e 79 | 0a 28 73 65 63 74 69 6f |, if any|.(sectio|
|000009d0| 6e 7e 5c 72 65 66 7b 69 | 6e 69 74 69 61 6c 65 6e |n~\ref{i|nitialen|
|000009e0| 76 7d 29 3b 20 69 66 20 | 74 68 65 72 65 20 69 73 |v}); if |there is|
|000009f0| 20 6e 6f 20 62 69 6e 64 | 69 6e 67 20 66 6f 72 20 | no bind|ing for |
|00000a00| 74 68 65 20 69 64 65 6e | 74 69 66 69 65 72 2c 0a |the iden|tifier,.|
|00000a10| 69 74 20 69 73 20 73 61 | 69 64 20 74 6f 20 62 65 |it is sa|id to be|
|00000a20| 20 5c 64 65 66 69 6e 69 | 6e 67 7b 75 6e 62 6f 75 | \defini|ng{unbou|
|00000a30| 6e 64 7d 2e 5c 6d 61 69 | 6e 69 6e 64 65 78 7b 62 |nd}.\mai|nindex{b|
|00000a40| 6f 75 6e 64 7d 5c 69 6e | 64 65 78 7b 74 6f 70 20 |ound}\in|dex{top |
|00000a50| 6c 65 76 65 6c 0a 65 6e | 76 69 72 6f 6e 6d 65 6e |level.en|vironmen|
|00000a60| 74 7d 0a 0a 5c 74 6f 64 | 6f 7b 4d 65 6e 74 69 6f |t}..\tod|o{Mentio|
|00000a70| 6e 20 74 68 61 74 20 73 | 6f 6d 65 20 69 6d 70 6c |n that s|ome impl|
|00000a80| 65 6d 65 6e 74 61 74 69 | 6f 6e 73 20 68 61 76 65 |ementati|ons have|
|00000a90| 20 6d 75 6c 74 69 70 6c | 65 20 74 6f 70 20 6c 65 | multipl|e top le|
|00000aa0| 76 65 6c 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 73 |vel envi|ronments|
|00000ab0| 3f 7d 0a 0a 5c 74 6f 64 | 6f 7b 50 69 74 6d 61 6e |?}..\tod|o{Pitman|
|00000ac0| 20 73 65 7a 3a 20 6e 65 | 65 64 73 20 65 6c 61 62 | sez: ne|eds elab|
|00000ad0| 6f 72 61 74 69 6f 6e 20 | 69 6e 20 63 61 73 65 20 |oration |in case |
|00000ae0| 6f 66 20 7b 5c 74 74 28 | 6c 65 74 20 2e 2e 2e 29 |of {\tt(|let ...)|
|00000af0| 7d 7d 0a 0a 5c 74 6f 64 | 6f 7b 50 69 74 6d 61 6e |}}..\tod|o{Pitman|
|00000b00| 20 61 73 6b 73 3a 20 73 | 61 79 20 73 6f 6d 65 74 | asks: s|ay somet|
|00000b10| 68 69 6e 67 20 61 62 6f | 75 74 20 76 61 72 73 20 |hing abo|ut vars |
|00000b20| 63 72 65 61 74 65 64 20 | 61 66 74 65 72 20 73 63 |created |after sc|
|00000b30| 68 65 6d 65 20 73 74 61 | 72 74 73 3f 0a 7b 5c 74 |heme sta|rts?.{\t|
|00000b40| 74 20 28 64 65 66 69 6e | 65 20 78 20 33 29 20 28 |t (defin|e x 3) (|
|00000b50| 64 65 66 69 6e 65 20 28 | 66 29 20 78 29 20 28 64 |define (|f) x) (d|
|00000b60| 65 66 69 6e 65 20 28 67 | 29 20 79 29 20 28 64 65 |efine (g|) y) (de|
|00000b70| 66 69 6e 65 20 79 20 34 | 29 7d 0a 43 6c 69 6e 67 |fine y 4|)}.Cling|
|00000b80| 65 72 20 72 65 70 6c 69 | 65 73 3a 20 54 68 65 20 |er repli|es: The |
|00000b90| 6c 61 6e 67 75 61 67 65 | 20 77 61 73 20 65 78 70 |language| was exp|
|00000ba0| 6c 69 63 69 74 6c 79 0a | 64 65 73 69 67 6e 65 64 |licitly.|designed|
|00000bb0| 20 74 6f 20 70 65 72 6d | 69 74 20 61 20 76 69 65 | to perm|it a vie|
|00000bc0| 77 20 69 6e 20 77 68 69 | 63 68 20 6e 6f 20 76 61 |w in whi|ch no va|
|00000bd0| 72 69 61 62 6c 65 73 20 | 61 72 65 20 63 72 65 61 |riables |are crea|
|00000be0| 74 65 64 20 61 66 74 65 | 72 0a 53 63 68 65 6d 65 |ted afte|r.Scheme|
|00000bf0| 20 73 74 61 72 74 73 2e | 20 20 49 6e 20 66 69 6c | starts.| In fil|
|00000c00| 65 73 2c 20 79 6f 75 20 | 63 61 6e 20 73 63 61 6e |es, you |can scan|
|00000c10| 20 6f 75 74 20 74 68 65 | 20 64 65 66 69 6e 69 74 | out the| definit|
|00000c20| 69 6f 6e 73 20 62 65 66 | 6f 72 65 68 61 6e 64 2e |ions bef|orehand.|
|00000c30| 0a 49 20 74 68 69 6e 6b | 20 77 65 27 72 65 20 61 |.I think| we're a|
|00000c40| 67 72 65 65 64 20 6f 6e | 20 74 68 65 20 70 72 69 |greed on| the pri|
|00000c50| 6e 63 69 70 6c 65 20 74 | 68 61 74 20 69 6e 74 65 |nciple t|hat inte|
|00000c60| 72 61 63 74 69 76 65 20 | 75 73 65 20 73 68 6f 75 |ractive |use shou|
|00000c70| 6c 64 0a 61 70 70 72 6f | 78 69 6d 61 74 65 20 74 |ld.appro|ximate t|
|00000c80| 68 61 74 20 62 65 68 61 | 76 69 6f 72 20 61 73 20 |hat beha|vior as |
|00000c90| 63 6c 6f 73 65 6c 79 20 | 61 73 20 70 6f 73 73 69 |closely |as possi|
|00000ca0| 62 6c 65 2c 20 74 68 6f | 75 67 68 20 77 65 20 64 |ble, tho|ugh we d|
|00000cb0| 6f 6e 27 74 20 79 65 74 | 0a 61 67 72 65 65 20 6f |on't yet|.agree o|
|00000cc0| 6e 20 77 68 69 63 68 20 | 70 72 6f 67 72 61 6d 6d |n which |programm|
|00000cd0| 69 6e 67 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |ing envi|ronment |
|00000ce0| 70 72 6f 76 69 64 65 73 | 20 74 68 65 20 62 65 73 |provides| the bes|
|00000cf0| 74 20 61 70 70 72 6f 78 | 69 6d 61 74 69 6f 6e 2e |t approx|imation.|
|00000d00| 7d 0a 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 54 72 75 |}...\sec|tion{Tru|
|00000d10| 65 20 61 6e 64 20 66 61 | 6c 73 65 7d 0a 0a 41 6e |e and fa|lse}..An|
|00000d20| 79 20 53 63 68 65 6d 65 | 20 76 61 6c 75 65 20 63 |y Scheme| value c|
|00000d30| 61 6e 20 62 65 20 75 73 | 65 64 20 61 73 20 61 20 |an be us|ed as a |
|00000d40| 62 6f 6f 6c 65 61 6e 20 | 76 61 6c 75 65 20 66 6f |boolean |value fo|
|00000d50| 72 20 74 68 65 20 70 75 | 72 70 6f 73 65 20 6f 66 |r the pu|rpose of|
|00000d60| 20 61 0a 63 6f 6e 64 69 | 74 69 6f 6e 61 6c 20 74 | a.condi|tional t|
|00000d70| 65 73 74 2e 20 20 41 73 | 20 65 78 70 6c 61 69 6e |est. As| explain|
|00000d80| 65 64 20 69 6e 20 73 65 | 63 74 69 6f 6e 7e 5c 72 |ed in se|ction~\r|
|00000d90| 65 66 7b 62 6f 6f 6c 65 | 61 6e 73 65 63 74 69 6f |ef{boole|ansectio|
|00000da0| 6e 7d 2c 20 61 6c 6c 0a | 76 61 6c 75 65 73 20 63 |n}, all.|values c|
|00000db0| 6f 75 6e 74 20 61 73 20 | 74 72 75 65 20 69 6e 20 |ount as |true in |
|00000dc0| 73 75 63 68 20 61 20 74 | 65 73 74 20 65 78 63 65 |such a t|est exce|
|00000dd0| 70 74 20 66 6f 72 20 5c | 73 63 68 66 61 6c 73 65 |pt for \|schfalse|
|00000de0| 7b 7d 20 61 6e 64 20 70 | 6f 73 73 69 62 6c 79 0a |{} and p|ossibly.|
|00000df0| 74 68 65 20 65 6d 70 74 | 79 20 6c 69 73 74 2e 20 |the empt|y list. |
|00000e00| 20 54 68 65 20 6f 6e 6c | 79 20 76 61 6c 75 65 20 | The onl|y value |
|00000e10| 74 68 61 74 20 69 73 20 | 67 75 61 72 61 6e 74 65 |that is |guarante|
|00000e20| 65 64 20 74 6f 20 63 6f | 75 6e 74 20 61 73 20 66 |ed to co|unt as f|
|00000e30| 61 6c 73 65 0a 69 73 20 | 5c 73 63 68 66 61 6c 73 |alse.is |\schfals|
|00000e40| 65 7b 7d 2e 20 20 49 74 | 20 69 73 20 65 78 70 6c |e{}. It| is expl|
|00000e50| 69 63 69 74 6c 79 20 75 | 6e 73 70 65 63 69 66 69 |icitly u|nspecifi|
|00000e60| 65 64 20 77 68 65 74 68 | 65 72 20 74 68 65 20 65 |ed wheth|er the e|
|00000e70| 6d 70 74 79 20 6c 69 73 | 74 0a 63 6f 75 6e 74 73 |mpty lis|t.counts|
|00000e80| 20 61 73 20 74 72 75 65 | 20 6f 72 20 61 73 20 66 | as true| or as f|
|00000e90| 61 6c 73 65 2e 20 20 54 | 68 69 73 20 72 65 70 6f |alse. T|his repo|
|00000ea0| 72 74 20 75 73 65 73 20 | 74 68 65 20 77 6f 72 64 |rt uses |the word|
|00000eb0| 20 60 60 74 72 75 65 27 | 27 20 74 6f 20 72 65 66 | ``true'|' to ref|
|00000ec0| 65 72 20 74 6f 20 61 6e | 79 0a 53 63 68 65 6d 65 |er to an|y.Scheme|
|00000ed0| 20 76 61 6c 75 65 20 74 | 68 61 74 20 63 6f 75 6e | value t|hat coun|
|00000ee0| 74 73 20 61 73 20 74 72 | 75 65 2c 20 61 6e 64 20 |ts as tr|ue, and |
|00000ef0| 74 68 65 20 77 6f 72 64 | 20 60 60 66 61 6c 73 65 |the word| ``false|
|00000f00| 27 27 20 74 6f 20 72 65 | 66 65 72 20 74 6f 20 61 |'' to re|fer to a|
|00000f10| 6e 79 20 53 63 68 65 6d | 65 0a 76 61 6c 75 65 20 |ny Schem|e.value |
|00000f20| 74 68 61 74 20 63 6f 75 | 6e 74 73 20 61 73 20 66 |that cou|nts as f|
|00000f30| 61 6c 73 65 2e 20 5c 6d | 61 69 6e 69 6e 64 65 78 |alse. \m|ainindex|
|00000f40| 7b 74 72 75 65 7d 20 5c | 6d 61 69 6e 69 6e 64 65 |{true} \|maininde|
|00000f50| 78 7b 66 61 6c 73 65 7d | 0a 0a 5c 74 6f 64 6f 7b |x{false}|..\todo{|
|00000f60| 42 61 72 74 6c 65 79 3a | 20 74 69 67 68 74 65 6e |Bartley:| tighten|
|00000f70| 20 74 68 69 73 20 75 70 | 2e 7d 0a 0a 0a 5c 73 65 | this up|.}...\se|
|00000f80| 63 74 69 6f 6e 7b 45 78 | 74 65 72 6e 61 6c 20 72 |ction{Ex|ternal r|
|00000f90| 65 70 72 65 73 65 6e 74 | 61 74 69 6f 6e 73 7d 0a |epresent|ations}.|
|00000fa0| 5c 6c 61 62 65 6c 7b 65 | 78 74 65 72 6e 61 6c 72 |\label{e|xternalr|
|00000fb0| 65 70 73 7d 0a 0a 41 6e | 20 69 6d 70 6f 72 74 61 |eps}..An| importa|
|00000fc0| 6e 74 20 63 6f 6e 63 65 | 70 74 20 69 6e 20 53 63 |nt conce|pt in Sc|
|00000fd0| 68 65 6d 65 20 28 61 6e | 64 20 4c 69 73 70 29 20 |heme (an|d Lisp) |
|00000fe0| 69 73 20 74 68 61 74 20 | 6f 66 20 74 68 65 20 7b |is that |of the {|
|00000ff0| 5c 65 6d 20 65 78 74 65 | 72 6e 61 6c 0a 72 65 70 |\em exte|rnal.rep|
|00001000| 72 65 73 65 6e 74 61 74 | 69 6f 6e 7d 20 6f 66 20 |resentat|ion} of |
|00001010| 61 6e 20 6f 62 6a 65 63 | 74 20 61 73 20 61 20 73 |an objec|t as a s|
|00001020| 65 71 75 65 6e 63 65 20 | 6f 66 20 63 68 61 72 61 |equence |of chara|
|00001030| 63 74 65 72 73 2e 20 20 | 46 6f 72 20 65 78 61 6d |cters. |For exam|
|00001040| 70 6c 65 2c 0a 61 6e 20 | 65 78 74 65 72 6e 61 6c |ple,.an |external|
|00001050| 20 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 20 | represe|ntation |
|00001060| 6f 66 20 74 68 65 20 69 | 6e 74 65 67 65 72 20 32 |of the i|nteger 2|
|00001070| 38 20 69 73 20 74 68 65 | 20 73 65 71 75 65 6e 63 |8 is the| sequenc|
|00001080| 65 20 6f 66 0a 63 68 61 | 72 61 63 74 65 72 73 20 |e of.cha|racters |
|00001090| 60 60 7b 5c 74 74 20 32 | 38 7d 27 27 2c 20 61 6e |``{\tt 2|8}'', an|
|000010a0| 64 20 61 6e 20 65 78 74 | 65 72 6e 61 6c 20 72 65 |d an ext|ernal re|
|000010b0| 70 72 65 73 65 6e 74 61 | 74 69 6f 6e 20 6f 66 20 |presenta|tion of |
|000010c0| 61 20 6c 69 73 74 20 63 | 6f 6e 73 69 73 74 69 6e |a list c|onsistin|
|000010d0| 67 0a 6f 66 20 74 68 65 | 20 69 6e 74 65 67 65 72 |g.of the| integer|
|000010e0| 73 20 38 20 61 6e 64 20 | 31 33 20 69 73 20 74 68 |s 8 and |13 is th|
|000010f0| 65 20 73 65 71 75 65 6e | 63 65 20 6f 66 20 63 68 |e sequen|ce of ch|
|00001100| 61 72 61 63 74 65 72 73 | 20 60 60 7b 5c 74 74 28 |aracters| ``{\tt(|
|00001110| 38 20 31 33 29 7d 27 27 | 2e 0a 0a 54 68 65 20 65 |8 13)}''|...The e|
|00001120| 78 74 65 72 6e 61 6c 20 | 72 65 70 72 65 73 65 6e |xternal |represen|
|00001130| 74 61 74 69 6f 6e 20 6f | 66 20 61 6e 20 6f 62 6a |tation o|f an obj|
|00001140| 65 63 74 20 69 73 20 6e | 6f 74 20 6e 65 63 65 73 |ect is n|ot neces|
|00001150| 73 61 72 69 6c 79 20 75 | 6e 69 71 75 65 2e 20 20 |sarily u|nique. |
|00001160| 54 68 65 0a 69 6e 74 65 | 67 65 72 20 32 38 20 61 |The.inte|ger 28 a|
|00001170| 6c 73 6f 20 68 61 73 20 | 72 65 70 72 65 73 65 6e |lso has |represen|
|00001180| 74 61 74 69 6f 6e 73 20 | 60 60 7b 5c 74 74 20 5c |tations |``{\tt \|
|00001190| 23 65 32 38 2e 30 30 30 | 7d 27 27 20 61 6e 64 20 |#e28.000|}'' and |
|000011a0| 60 60 7b 5c 74 74 5c 23 | 78 31 63 7d 27 27 2c 20 |``{\tt\#|x1c}'', |
|000011b0| 61 6e 64 20 74 68 65 0a | 6c 69 73 74 20 69 6e 20 |and the.|list in |
|000011c0| 74 68 65 20 70 72 65 76 | 69 6f 75 73 20 70 61 72 |the prev|ious par|
|000011d0| 61 67 72 61 70 68 20 61 | 6c 73 6f 20 68 61 73 20 |agraph a|lso has |
|000011e0| 74 68 65 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |the repr|esentati|
|000011f0| 6f 6e 73 20 60 60 7b 5c | 74 74 28 20 30 38 20 31 |ons ``{\|tt( 08 1|
|00001200| 33 0a 29 7d 27 27 20 61 | 6e 64 20 60 60 7b 5c 74 |3.)}'' a|nd ``{\t|
|00001210| 74 28 38 20 2e 5c 20 28 | 31 33 20 2e 5c 20 28 29 |t(8 .\ (|13 .\ ()|
|00001220| 29 29 7d 27 27 20 28 73 | 65 65 20 73 65 63 74 69 |))}'' (s|ee secti|
|00001230| 6f 6e 7e 5c 72 65 66 7b | 6c 69 73 74 73 65 63 74 |on~\ref{|listsect|
|00001240| 69 6f 6e 7d 29 2e 0a 0a | 4d 61 6e 79 20 6f 62 6a |ion})...|Many obj|
|00001250| 65 63 74 73 20 68 61 76 | 65 20 73 74 61 6e 64 61 |ects hav|e standa|
|00001260| 72 64 20 65 78 74 65 72 | 6e 61 6c 20 72 65 70 72 |rd exter|nal repr|
|00001270| 65 73 65 6e 74 61 74 69 | 6f 6e 73 2c 20 62 75 74 |esentati|ons, but|
|00001280| 20 73 6f 6d 65 2c 20 73 | 75 63 68 20 61 73 0a 70 | some, s|uch as.p|
|00001290| 72 6f 63 65 64 75 72 65 | 73 2c 20 64 6f 20 6e 6f |rocedure|s, do no|
|000012a0| 74 20 68 61 76 65 20 73 | 74 61 6e 64 61 72 64 20 |t have s|tandard |
|000012b0| 72 65 70 72 65 73 65 6e | 74 61 74 69 6f 6e 73 20 |represen|tations |
|000012c0| 28 61 6c 74 68 6f 75 67 | 68 20 70 61 72 74 69 63 |(althoug|h partic|
|000012d0| 75 6c 61 72 0a 69 6d 70 | 6c 65 6d 65 6e 74 61 74 |ular.imp|lementat|
|000012e0| 69 6f 6e 73 20 6d 61 79 | 20 64 65 66 69 6e 65 20 |ions may| define |
|000012f0| 72 65 70 72 65 73 65 6e | 74 61 74 69 6f 6e 73 20 |represen|tations |
|00001300| 66 6f 72 20 74 68 65 6d | 29 2e 0a 0a 41 6e 20 65 |for them|)...An e|
|00001310| 78 74 65 72 6e 61 6c 20 | 72 65 70 72 65 73 65 6e |xternal |represen|
|00001320| 74 61 74 69 6f 6e 20 6d | 61 79 20 62 65 20 77 72 |tation m|ay be wr|
|00001330| 69 74 74 65 6e 20 69 6e | 20 61 20 70 72 6f 67 72 |itten in| a progr|
|00001340| 61 6d 20 74 6f 20 6f 62 | 74 61 69 6e 20 74 68 65 |am to ob|tain the|
|00001350| 0a 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 6f |.corresp|onding o|
|00001360| 62 6a 65 63 74 20 28 73 | 65 65 20 5c 69 64 65 7b |bject (s|ee \ide{|
|00001370| 71 75 6f 74 65 7d 2c 20 | 73 65 63 74 69 6f 6e 7e |quote}, |section~|
|00001380| 5c 72 65 66 7b 71 75 6f | 74 65 7d 29 2e 0a 0a 45 |\ref{quo|te})...E|
|00001390| 78 74 65 72 6e 61 6c 20 | 72 65 70 72 65 73 65 6e |xternal |represen|
|000013a0| 74 61 74 69 6f 6e 73 20 | 63 61 6e 20 61 6c 73 6f |tations |can also|
|000013b0| 20 62 65 20 75 73 65 64 | 20 66 6f 72 20 69 6e 70 | be used| for inp|
|000013c0| 75 74 20 61 6e 64 20 6f | 75 74 70 75 74 2e 20 20 |ut and o|utput. |
|000013d0| 54 68 65 0a 70 72 6f 63 | 65 64 75 72 65 20 5c 69 |The.proc|edure \i|
|000013e0| 64 65 7b 72 65 61 64 7d | 20 28 73 65 63 74 69 6f |de{read}| (sectio|
|000013f0| 6e 7e 5c 72 65 66 7b 72 | 65 61 64 7d 29 20 70 61 |n~\ref{r|ead}) pa|
|00001400| 72 73 65 73 20 65 78 74 | 65 72 6e 61 6c 0a 72 65 |rses ext|ernal.re|
|00001410| 70 72 65 73 65 6e 74 61 | 74 69 6f 6e 73 2c 20 61 |presenta|tions, a|
|00001420| 6e 64 20 74 68 65 20 70 | 72 6f 63 65 64 75 72 65 |nd the p|rocedure|
|00001430| 20 5c 69 64 65 7b 77 72 | 69 74 65 7d 20 28 73 65 | \ide{wr|ite} (se|
|00001440| 63 74 69 6f 6e 7e 5c 72 | 65 66 7b 77 72 69 74 65 |ction~\r|ef{write|
|00001450| 7d 29 0a 67 65 6e 65 72 | 61 74 65 73 20 74 68 65 |}).gener|ates the|
|00001460| 6d 2e 20 20 54 6f 67 65 | 74 68 65 72 2c 20 74 68 |m. Toge|ther, th|
|00001470| 65 79 20 70 72 6f 76 69 | 64 65 20 61 6e 20 65 6c |ey provi|de an el|
|00001480| 65 67 61 6e 74 20 61 6e | 64 20 70 6f 77 65 72 66 |egant an|d powerf|
|00001490| 75 6c 0a 69 6e 70 75 74 | 2f 6f 75 74 70 75 74 20 |ul.input|/output |
|000014a0| 66 61 63 69 6c 69 74 79 | 2e 0a 0a 4e 6f 74 65 20 |facility|...Note |
|000014b0| 74 68 61 74 20 74 68 65 | 20 73 65 71 75 65 6e 63 |that the| sequenc|
|000014c0| 65 20 6f 66 20 63 68 61 | 72 61 63 74 65 72 73 20 |e of cha|racters |
|000014d0| 60 60 7b 5c 74 74 28 2b | 20 32 20 36 29 7d 27 27 |``{\tt(+| 2 6)}''|
|000014e0| 20 69 73 20 7b 5c 65 6d | 20 6e 6f 74 7d 20 61 6e | is {\em| not} an|
|000014f0| 0a 65 78 74 65 72 6e 61 | 6c 20 72 65 70 72 65 73 |.externa|l repres|
|00001500| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |entation| of the |
|00001510| 69 6e 74 65 67 65 72 20 | 38 2c 20 65 76 65 6e 20 |integer |8, even |
|00001520| 74 68 6f 75 67 68 20 69 | 74 20 7b 5c 65 6d 20 69 |though i|t {\em i|
|00001530| 73 7d 20 61 6e 0a 65 78 | 70 72 65 73 73 69 6f 6e |s} an.ex|pression|
|00001540| 20 65 76 61 6c 75 61 74 | 69 6e 67 20 74 6f 20 74 | evaluat|ing to t|
|00001550| 68 65 20 69 6e 74 65 67 | 65 72 20 38 3b 20 72 61 |he integ|er 8; ra|
|00001560| 74 68 65 72 2c 20 69 74 | 20 69 73 20 61 6e 20 65 |ther, it| is an e|
|00001570| 78 74 65 72 6e 61 6c 0a | 72 65 70 72 65 73 65 6e |xternal.|represen|
|00001580| 74 61 74 69 6f 6e 20 6f | 66 20 61 20 74 68 72 65 |tation o|f a thre|
|00001590| 65 2d 65 6c 65 6d 65 6e | 74 20 6c 69 73 74 2c 20 |e-elemen|t list, |
|000015a0| 74 68 65 20 65 6c 65 6d | 65 6e 74 73 20 6f 66 20 |the elem|ents of |
|000015b0| 77 68 69 63 68 20 61 72 | 65 20 74 68 65 20 73 79 |which ar|e the sy|
|000015c0| 6d 62 6f 6c 0a 7b 5c 74 | 74 20 2b 7d 20 61 6e 64 |mbol.{\t|t +} and|
|000015d0| 20 74 68 65 20 69 6e 74 | 65 67 65 72 73 20 32 20 | the int|egers 2 |
|000015e0| 61 6e 64 20 36 2e 20 20 | 53 63 68 65 6d 65 27 73 |and 6. |Scheme's|
|000015f0| 20 73 79 6e 74 61 78 20 | 68 61 73 20 74 68 65 20 | syntax |has the |
|00001600| 70 72 6f 70 65 72 74 79 | 20 74 68 61 74 0a 61 6e |property| that.an|
|00001610| 79 20 73 65 71 75 65 6e | 63 65 20 6f 66 20 63 68 |y sequen|ce of ch|
|00001620| 61 72 61 63 74 65 72 73 | 20 77 68 69 63 68 20 69 |aracters| which i|
|00001630| 73 20 61 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |s an exp|ression |
|00001640| 69 73 20 61 6c 73 6f 20 | 74 68 65 20 65 78 74 65 |is also |the exte|
|00001650| 72 6e 61 6c 0a 72 65 70 | 72 65 73 65 6e 74 61 74 |rnal.rep|resentat|
|00001660| 69 6f 6e 20 6f 66 20 73 | 6f 6d 65 20 6f 62 6a 65 |ion of s|ome obje|
|00001670| 63 74 2e 20 20 54 68 69 | 73 20 63 61 6e 20 6c 65 |ct. Thi|s can le|
|00001680| 61 64 20 74 6f 20 63 6f | 6e 66 75 73 69 6f 6e 2c |ad to co|nfusion,|
|00001690| 20 73 69 6e 63 65 20 69 | 74 20 6d 61 79 0a 6e 6f | since i|t may.no|
|000016a0| 74 20 62 65 20 6f 62 76 | 69 6f 75 73 20 6f 75 74 |t be obv|ious out|
|000016b0| 20 6f 66 20 63 6f 6e 74 | 65 78 74 20 77 68 65 74 | of cont|ext whet|
|000016c0| 68 65 72 20 61 20 67 69 | 76 65 6e 20 73 65 71 75 |her a gi|ven sequ|
|000016d0| 65 6e 63 65 20 6f 66 20 | 63 68 61 72 61 63 74 65 |ence of |characte|
|000016e0| 72 73 20 69 73 0a 69 6e | 74 65 6e 64 65 64 20 74 |rs is.in|tended t|
|000016f0| 6f 20 64 65 6e 6f 74 65 | 20 64 61 74 61 20 6f 72 |o denote| data or|
|00001700| 20 70 72 6f 67 72 61 6d | 2c 20 62 75 74 20 69 74 | program|, but it|
|00001710| 20 69 73 20 61 6c 73 6f | 20 61 20 73 6f 75 72 63 | is also| a sourc|
|00001720| 65 20 6f 66 20 70 6f 77 | 65 72 2c 0a 73 69 6e 63 |e of pow|er,.sinc|
|00001730| 65 20 69 74 20 66 61 63 | 69 6c 69 74 61 74 65 73 |e it fac|ilitates|
|00001740| 20 77 72 69 74 69 6e 67 | 20 70 72 6f 67 72 61 6d | writing| program|
|00001750| 73 20 73 75 63 68 20 61 | 73 20 69 6e 74 65 72 70 |s such a|s interp|
|00001760| 72 65 74 65 72 73 20 61 | 6e 64 0a 63 6f 6d 70 69 |reters a|nd.compi|
|00001770| 6c 65 72 73 20 77 68 69 | 63 68 20 74 72 65 61 74 |lers whi|ch treat|
|00001780| 20 70 72 6f 67 72 61 6d | 73 20 61 73 20 64 61 74 | program|s as dat|
|00001790| 61 20 28 6f 72 20 76 69 | 63 65 20 76 65 72 73 61 |a (or vi|ce versa|
|000017a0| 29 2e 0a 0a 54 68 65 20 | 73 79 6e 74 61 78 20 6f |)...The |syntax o|
|000017b0| 66 20 65 78 74 65 72 6e | 61 6c 20 72 65 70 72 65 |f extern|al repre|
|000017c0| 73 65 6e 74 61 74 69 6f | 6e 73 20 6f 66 20 76 61 |sentatio|ns of va|
|000017d0| 72 69 6f 75 73 20 6b 69 | 6e 64 73 20 6f 66 20 6f |rious ki|nds of o|
|000017e0| 62 6a 65 63 74 73 0a 61 | 63 63 6f 6d 70 61 6e 69 |bjects.a|ccompani|
|000017f0| 65 73 20 74 68 65 20 64 | 65 73 63 72 69 70 74 69 |es the d|escripti|
|00001800| 6f 6e 20 6f 66 20 74 68 | 65 20 70 72 69 6d 69 74 |on of th|e primit|
|00001810| 69 76 65 73 20 66 6f 72 | 20 6d 61 6e 69 70 75 6c |ives for| manipul|
|00001820| 61 74 69 6e 67 20 74 68 | 65 0a 6f 62 6a 65 63 74 |ating th|e.object|
|00001830| 73 20 69 6e 20 74 68 65 | 20 61 70 70 72 6f 70 72 |s in the| appropr|
|00001840| 69 61 74 65 20 73 65 63 | 74 69 6f 6e 73 20 6f 66 |iate sec|tions of|
|00001850| 20 63 68 61 70 74 65 72 | 7e 5c 72 65 66 7b 69 6e | chapter|~\ref{in|
|00001860| 69 74 69 61 6c 65 6e 76 | 7d 2e 0a 0a 0a 5c 73 65 |itialenv|}....\se|
|00001870| 63 74 69 6f 6e 7b 44 69 | 73 6a 6f 69 6e 74 6e 65 |ction{Di|sjointne|
|00001880| 73 73 20 6f 66 20 74 79 | 70 65 73 7d 0a 5c 6c 61 |ss of ty|pes}.\la|
|00001890| 62 65 6c 7b 64 69 73 6a | 6f 69 6e 74 6e 65 73 73 |bel{disj|ointness|
|000018a0| 7d 0a 0a 4e 6f 20 6f 62 | 6a 65 63 74 20 73 61 74 |}..No ob|ject sat|
|000018b0| 69 73 66 69 65 73 20 6d | 6f 72 65 20 74 68 61 6e |isfies m|ore than|
|000018c0| 20 6f 6e 65 20 6f 66 20 | 74 68 65 20 66 6f 6c 6c | one of |the foll|
|000018d0| 6f 77 69 6e 67 20 70 72 | 65 64 69 63 61 74 65 73 |owing pr|edicates|
|000018e0| 3a 0a 0a 5c 62 65 67 69 | 6e 7b 73 63 68 65 6d 65 |:..\begi|n{scheme|
|000018f0| 7d 0a 62 6f 6f 6c 65 61 | 6e 3f 20 20 20 20 20 20 |}.boolea|n? |
|00001900| 20 20 20 20 70 61 69 72 | 3f 0a 73 79 6d 62 6f 6c | pair|?.symbol|
|00001910| 3f 20 20 20 20 20 20 20 | 20 20 20 20 6e 75 6d 62 |? | numb|
|00001920| 65 72 3f 0a 63 68 61 72 | 3f 20 20 20 20 20 20 20 |er?.char|? |
|00001930| 20 20 20 20 20 20 73 74 | 72 69 6e 67 3f 0a 76 65 | st|ring?.ve|
|00001940| 63 74 6f 72 3f 20 20 20 | 20 20 20 20 20 20 20 20 |ctor? | |
|00001950| 70 72 6f 63 65 64 75 72 | 65 3f 25 0a 5c 65 6e 64 |procedur|e?%.\end|
|00001960| 7b 73 63 68 65 6d 65 7d | 0a 0a 54 68 65 73 65 20 |{scheme}|..These |
|00001970| 70 72 65 64 69 63 61 74 | 65 73 20 64 65 66 69 6e |predicat|es defin|
|00001980| 65 20 74 68 65 20 74 79 | 70 65 73 20 7b 5c 65 6d |e the ty|pes {\em|
|00001990| 20 62 6f 6f 6c 65 61 6e | 7d 2c 20 7b 5c 65 6d 20 | boolean|}, {\em |
|000019a0| 70 61 69 72 7d 2c 20 7b | 5c 65 6d 0a 73 79 6d 62 |pair}, {|\em.symb|
|000019b0| 6f 6c 7d 2c 20 7b 5c 65 | 6d 20 6e 75 6d 62 65 72 |ol}, {\e|m number|
|000019c0| 7d 2c 20 7b 5c 65 6d 20 | 63 68 61 72 7d 20 28 6f |}, {\em |char} (o|
|000019d0| 72 20 7b 5c 65 6d 20 63 | 68 61 72 61 63 74 65 72 |r {\em c|haracter|
|000019e0| 7d 29 2c 20 7b 5c 65 6d | 20 73 74 72 69 6e 67 7d |}), {\em| string}|
|000019f0| 2c 20 7b 5c 65 6d 0a 76 | 65 63 74 6f 72 7d 2c 20 |, {\em.v|ector}, |
|00001a00| 61 6e 64 20 7b 5c 65 6d | 20 70 72 6f 63 65 64 75 |and {\em| procedu|
|00001a10| 72 65 7d 2e 5c 6d 61 69 | 6e 69 6e 64 65 78 7b 74 |re}.\mai|nindex{t|
|00001a20| 79 70 65 7d 0a 0a 0a 5c | 73 65 63 74 69 6f 6e 7b |ype}...\|section{|
|00001a30| 53 74 6f 72 61 67 65 20 | 6d 6f 64 65 6c 7d 0a 5c |Storage |model}.\|
|00001a40| 6c 61 62 65 6c 7b 73 74 | 6f 72 61 67 65 6d 6f 64 |label{st|oragemod|
|00001a50| 65 6c 7d 0a 0a 56 61 72 | 69 61 62 6c 65 73 20 61 |el}..Var|iables a|
|00001a60| 6e 64 20 6f 62 6a 65 63 | 74 73 20 73 75 63 68 20 |nd objec|ts such |
|00001a70| 61 73 20 70 61 69 72 73 | 2c 20 76 65 63 74 6f 72 |as pairs|, vector|
|00001a80| 73 2c 20 61 6e 64 20 73 | 74 72 69 6e 67 73 20 69 |s, and s|trings i|
|00001a90| 6d 70 6c 69 63 69 74 6c | 79 0a 64 65 6e 6f 74 65 |mplicitl|y.denote|
|00001aa0| 20 6c 6f 63 61 74 69 6f | 6e 73 5c 6d 61 69 6e 69 | locatio|ns\maini|
|00001ab0| 6e 64 65 78 7b 6c 6f 63 | 61 74 69 6f 6e 7d 20 6f |ndex{loc|ation} o|
|00001ac0| 72 20 73 65 71 75 65 6e | 63 65 73 20 6f 66 20 6c |r sequen|ces of l|
|00001ad0| 6f 63 61 74 69 6f 6e 73 | 2e 20 20 41 20 73 74 72 |ocations|. A str|
|00001ae0| 69 6e 67 2c 20 66 6f 72 | 0a 65 78 61 6d 70 6c 65 |ing, for|.example|
|00001af0| 2c 20 64 65 6e 6f 74 65 | 73 20 61 73 20 6d 61 6e |, denote|s as man|
|00001b00| 79 20 6c 6f 63 61 74 69 | 6f 6e 73 20 61 73 20 74 |y locati|ons as t|
|00001b10| 68 65 72 65 20 61 72 65 | 20 63 68 61 72 61 63 74 |here are| charact|
|00001b20| 65 72 73 20 69 6e 20 74 | 68 65 20 73 74 72 69 6e |ers in t|he strin|
|00001b30| 67 2e 20 0a 28 54 68 65 | 73 65 20 6c 6f 63 61 74 |g. .(The|se locat|
|00001b40| 69 6f 6e 73 20 6e 65 65 | 64 20 6e 6f 74 20 63 6f |ions nee|d not co|
|00001b50| 72 72 65 73 70 6f 6e 64 | 20 74 6f 20 61 20 66 75 |rrespond| to a fu|
|00001b60| 6c 6c 20 6d 61 63 68 69 | 6e 65 20 77 6f 72 64 2e |ll machi|ne word.|
|00001b70| 29 20 41 20 6e 65 77 20 | 76 61 6c 75 65 20 6d 61 |) A new |value ma|
|00001b80| 79 20 62 65 0a 73 74 6f | 72 65 64 20 69 6e 74 6f |y be.sto|red into|
|00001b90| 20 6f 6e 65 20 6f 66 20 | 74 68 65 73 65 20 6c 6f | one of |these lo|
|00001ba0| 63 61 74 69 6f 6e 73 20 | 75 73 69 6e 67 20 74 68 |cations |using th|
|00001bb0| 65 20 7b 5c 74 74 20 73 | 74 72 69 6e 67 2d 73 65 |e {\tt s|tring-se|
|00001bc0| 74 21 7d 20 70 72 6f 63 | 65 64 75 72 65 2c 20 62 |t!} proc|edure, b|
|00001bd0| 75 74 0a 74 68 65 20 73 | 74 72 69 6e 67 20 63 6f |ut.the s|tring co|
|00001be0| 6e 74 69 6e 75 65 73 20 | 74 6f 20 64 65 6e 6f 74 |ntinues |to denot|
|00001bf0| 65 20 74 68 65 20 73 61 | 6d 65 20 6c 6f 63 61 74 |e the sa|me locat|
|00001c00| 69 6f 6e 73 20 61 73 20 | 62 65 66 6f 72 65 2e 0a |ions as |before..|
|00001c10| 0a 41 6e 20 6f 62 6a 65 | 63 74 20 66 65 74 63 68 |.An obje|ct fetch|
|00001c20| 65 64 20 66 72 6f 6d 20 | 61 20 6c 6f 63 61 74 69 |ed from |a locati|
|00001c30| 6f 6e 2c 20 62 79 20 61 | 20 76 61 72 69 61 62 6c |on, by a| variabl|
|00001c40| 65 20 72 65 66 65 72 65 | 6e 63 65 20 6f 72 20 62 |e refere|nce or b|
|00001c50| 79 0a 61 20 70 72 6f 63 | 65 64 75 72 65 20 73 75 |y.a proc|edure su|
|00001c60| 63 68 20 61 73 20 5c 69 | 64 65 7b 63 61 72 7d 2c |ch as \i|de{car},|
|00001c70| 20 5c 69 64 65 7b 76 65 | 63 74 6f 72 2d 72 65 66 | \ide{ve|ctor-ref|
|00001c80| 7d 2c 20 6f 72 20 5c 69 | 64 65 7b 73 74 72 69 6e |}, or \i|de{strin|
|00001c90| 67 2d 72 65 66 7d 2c 20 | 69 73 0a 65 71 75 69 76 |g-ref}, |is.equiv|
|00001ca0| 61 6c 65 6e 74 20 69 6e | 20 74 68 65 20 73 65 6e |alent in| the sen|
|00001cb0| 73 65 20 6f 66 20 5c 69 | 64 65 7b 65 71 76 3f 7d |se of \i|de{eqv?}|
|00001cc0| 20 28 73 65 63 74 69 6f | 6e 7e 5c 72 65 66 7b 65 | (sectio|n~\ref{e|
|00001cd0| 71 75 69 76 61 6c 65 6e | 63 65 73 65 63 74 69 6f |quivalen|cesectio|
|00001ce0| 6e 7d 29 0a 74 6f 20 74 | 68 65 20 6f 62 6a 65 63 |n}).to t|he objec|
|00001cf0| 74 20 6c 61 73 74 20 73 | 74 6f 72 65 64 20 69 6e |t last s|tored in|
|00001d00| 20 74 68 65 20 6c 6f 63 | 61 74 69 6f 6e 20 62 65 | the loc|ation be|
|00001d10| 66 6f 72 65 20 74 68 65 | 20 66 65 74 63 68 2e 0a |fore the| fetch..|
|00001d20| 0a 45 76 65 72 79 20 6c | 6f 63 61 74 69 6f 6e 20 |.Every l|ocation |
|00001d30| 69 73 20 6d 61 72 6b 65 | 64 20 74 6f 20 73 68 6f |is marke|d to sho|
|00001d40| 77 20 77 68 65 74 68 65 | 72 20 69 74 20 69 73 20 |w whethe|r it is |
|00001d50| 69 6e 20 75 73 65 2e 0a | 4e 6f 20 76 61 72 69 61 |in use..|No varia|
|00001d60| 62 6c 65 20 6f 72 20 6f | 62 6a 65 63 74 20 65 76 |ble or o|bject ev|
|00001d70| 65 72 20 72 65 66 65 72 | 73 20 74 6f 20 61 20 6c |er refer|s to a l|
|00001d80| 6f 63 61 74 69 6f 6e 20 | 74 68 61 74 20 69 73 20 |ocation |that is |
|00001d90| 6e 6f 74 20 69 6e 20 75 | 73 65 2e 0a 57 68 65 6e |not in u|se..When|
|00001da0| 65 76 65 72 20 74 68 69 | 73 20 72 65 70 6f 72 74 |ever thi|s report|
|00001db0| 20 73 70 65 61 6b 73 20 | 6f 66 20 73 74 6f 72 61 | speaks |of stora|
|00001dc0| 67 65 20 62 65 69 6e 67 | 20 61 6c 6c 6f 63 61 74 |ge being| allocat|
|00001dd0| 65 64 20 66 6f 72 20 61 | 20 76 61 72 69 61 62 6c |ed for a| variabl|
|00001de0| 65 0a 6f 72 20 6f 62 6a | 65 63 74 2c 20 77 68 61 |e.or obj|ect, wha|
|00001df0| 74 20 69 73 20 6d 65 61 | 6e 74 20 69 73 20 74 68 |t is mea|nt is th|
|00001e00| 61 74 20 61 6e 20 61 70 | 70 72 6f 70 72 69 61 74 |at an ap|propriat|
|00001e10| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 6c 6f 63 61 |e number| of loca|
|00001e20| 74 69 6f 6e 73 20 61 72 | 65 0a 63 68 6f 73 65 6e |tions ar|e.chosen|
|00001e30| 20 66 72 6f 6d 20 74 68 | 65 20 73 65 74 20 6f 66 | from th|e set of|
|00001e40| 20 6c 6f 63 61 74 69 6f | 6e 73 20 74 68 61 74 20 | locatio|ns that |
|00001e50| 61 72 65 20 6e 6f 74 20 | 69 6e 20 75 73 65 2c 20 |are not |in use, |
|00001e60| 61 6e 64 20 74 68 65 20 | 63 68 6f 73 65 6e 0a 6c |and the |chosen.l|
|00001e70| 6f 63 61 74 69 6f 6e 73 | 20 61 72 65 20 6d 61 72 |ocations| are mar|
|00001e80| 6b 65 64 20 74 6f 20 69 | 6e 64 69 63 61 74 65 20 |ked to i|ndicate |
|00001e90| 74 68 61 74 20 74 68 65 | 79 20 61 72 65 20 6e 6f |that the|y are no|
|00001ea0| 77 20 69 6e 20 75 73 65 | 20 62 65 66 6f 72 65 20 |w in use| before |
|00001eb0| 74 68 65 20 76 61 72 69 | 61 62 6c 65 0a 6f 72 20 |the vari|able.or |
|00001ec0| 6f 62 6a 65 63 74 20 69 | 73 20 6d 61 64 65 20 74 |object i|s made t|
|00001ed0| 6f 20 64 65 6e 6f 74 65 | 20 74 68 65 6d 2e 0a 0a |o denote| them...|
|00001ee0| 49 6e 20 6d 61 6e 79 20 | 73 79 73 74 65 6d 73 20 |In many |systems |
|00001ef0| 69 74 20 69 73 20 64 65 | 73 69 72 61 62 6c 65 20 |it is de|sirable |
|00001f00| 66 6f 72 20 63 6f 6e 73 | 74 61 6e 74 73 5c 69 6e |for cons|tants\in|
|00001f10| 64 65 78 7b 63 6f 6e 73 | 74 61 6e 74 7d 20 28 69 |dex{cons|tant} (i|
|00001f20| 2e 65 2e 20 74 68 65 20 | 76 61 6c 75 65 73 20 6f |.e. the |values o|
|00001f30| 66 0a 6c 69 74 65 72 61 | 6c 20 65 78 70 72 65 73 |f.litera|l expres|
|00001f40| 73 69 6f 6e 73 29 20 74 | 6f 20 72 65 73 69 64 65 |sions) t|o reside|
|00001f50| 20 69 6e 20 72 65 61 64 | 2d 6f 6e 6c 79 2d 6d 65 | in read|-only-me|
|00001f60| 6d 6f 72 79 2e 20 20 54 | 6f 20 65 78 70 72 65 73 |mory. T|o expres|
|00001f70| 73 20 74 68 69 73 2c 20 | 69 74 20 69 73 0a 63 6f |s this, |it is.co|
|00001f80| 6e 76 65 6e 69 65 6e 74 | 20 74 6f 20 69 6d 61 67 |nvenient| to imag|
|00001f90| 69 6e 65 20 74 68 61 74 | 20 65 76 65 72 79 20 6f |ine that| every o|
|00001fa0| 62 6a 65 63 74 20 74 68 | 61 74 20 64 65 6e 6f 74 |bject th|at denot|
|00001fb0| 65 73 20 6c 6f 63 61 74 | 69 6f 6e 73 20 69 73 20 |es locat|ions is |
|00001fc0| 61 73 73 6f 63 69 61 74 | 65 64 0a 77 69 74 68 20 |associat|ed.with |
|00001fd0| 61 20 66 6c 61 67 20 74 | 65 6c 6c 69 6e 67 20 77 |a flag t|elling w|
|00001fe0| 68 65 74 68 65 72 20 74 | 68 61 74 20 6f 62 6a 65 |hether t|hat obje|
|00001ff0| 63 74 20 69 73 20 6d 75 | 74 61 62 6c 65 5c 69 6e |ct is mu|table\in|
|00002000| 64 65 78 7b 6d 75 74 61 | 62 6c 65 7d 20 6f 72 0a |dex{muta|ble} or.|
|00002010| 69 6d 6d 75 74 61 62 6c | 65 5c 69 6e 64 65 78 7b |immutabl|e\index{|
|00002020| 69 6d 6d 75 74 61 62 6c | 65 7d 2e 20 20 54 68 65 |immutabl|e}. The|
|00002030| 20 63 6f 6e 73 74 61 6e | 74 73 20 61 6e 64 20 74 | constan|ts and t|
|00002040| 68 65 20 73 74 72 69 6e | 67 73 20 72 65 74 75 72 |he strin|gs retur|
|00002050| 6e 65 64 20 62 79 0a 5c | 69 64 65 7b 73 79 6d 62 |ned by.\|ide{symb|
|00002060| 6f 6c 2d 3e 73 74 72 69 | 6e 67 7d 20 61 72 65 20 |ol->stri|ng} are |
|00002070| 74 68 65 6e 20 74 68 65 | 20 69 6d 6d 75 74 61 62 |then the| immutab|
|00002080| 6c 65 20 6f 62 6a 65 63 | 74 73 2c 20 77 68 69 6c |le objec|ts, whil|
|00002090| 65 20 61 6c 6c 20 6f 62 | 6a 65 63 74 73 20 63 72 |e all ob|jects cr|
|000020a0| 65 61 74 65 64 20 62 79 | 0a 74 68 65 20 6f 74 68 |eated by|.the oth|
|000020b0| 65 72 20 70 72 6f 63 65 | 64 75 72 65 73 20 6c 69 |er proce|dures li|
|000020c0| 73 74 65 64 20 69 6e 20 | 74 68 69 73 20 72 65 70 |sted in |this rep|
|000020d0| 6f 72 74 20 61 72 65 20 | 6d 75 74 61 62 6c 65 2e |ort are |mutable.|
|000020e0| 20 20 49 74 20 69 73 20 | 61 6e 20 65 72 72 6f 72 | It is |an error|
|000020f0| 20 74 6f 0a 61 74 74 65 | 6d 70 74 20 74 6f 20 73 | to.atte|mpt to s|
|00002100| 74 6f 72 65 20 61 20 6e | 65 77 20 76 61 6c 75 65 |tore a n|ew value|
|00002110| 20 69 6e 74 6f 20 61 20 | 6c 6f 63 61 74 69 6f 6e | into a |location|
|00002120| 20 74 68 61 74 20 69 73 | 20 64 65 6e 6f 74 65 64 | that is| denoted|
|00002130| 20 62 79 20 61 6e 20 69 | 6d 6d 75 74 61 62 6c 65 | by an i|mmutable|
|00002140| 0a 6f 62 6a 65 63 74 2e | 0a |.object.|. |
+--------+-------------------------+-------------------------+--------+--------+